| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Touchkey driver for MELFAS MCS5000/5080 controller |
|---|
| 3 | 4 | * |
|---|
| 4 | 5 | * Copyright (C) 2010 Samsung Electronics Co.Ltd |
|---|
| 5 | 6 | * Author: HeungJun Kim <riverful.kim@samsung.com> |
|---|
| 6 | 7 | * Author: Joonyoung Shim <jy0922.shim@samsung.com> |
|---|
| 7 | | - * |
|---|
| 8 | | - * This program is free software; you can redistribute it and/or modify it |
|---|
| 9 | | - * under the terms of the GNU General Public License as published by the |
|---|
| 10 | | - * Free Software Foundation; either version 2 of the License, or (at your |
|---|
| 11 | | - * option) any later version. |
|---|
| 12 | 8 | */ |
|---|
| 13 | 9 | |
|---|
| 14 | 10 | #include <linux/module.h> |
|---|
| .. | .. |
|---|
| 113 | 109 | return -EINVAL; |
|---|
| 114 | 110 | } |
|---|
| 115 | 111 | |
|---|
| 116 | | - data = kzalloc(sizeof(struct mcs_touchkey_data) + |
|---|
| 117 | | - sizeof(data->keycodes[0]) * (pdata->key_maxval + 1), |
|---|
| 118 | | - GFP_KERNEL); |
|---|
| 112 | + data = kzalloc(struct_size(data, keycodes, pdata->key_maxval + 1), |
|---|
| 113 | + GFP_KERNEL); |
|---|
| 119 | 114 | input_dev = input_allocate_device(); |
|---|
| 120 | 115 | if (!data || !input_dev) { |
|---|
| 121 | 116 | dev_err(&client->dev, "Failed to allocate memory\n"); |
|---|