hc
2023-12-11 d2ccde1c8e90d38cee87a1b0309ad2827f3fd30d
kernel/drivers/input/keyboard/mcs_touchkey.c
....@@ -1,14 +1,10 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * Touchkey driver for MELFAS MCS5000/5080 controller
34 *
45 * Copyright (C) 2010 Samsung Electronics Co.Ltd
56 * Author: HeungJun Kim <riverful.kim@samsung.com>
67 * 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.
128 */
139
1410 #include <linux/module.h>
....@@ -113,9 +109,8 @@
113109 return -EINVAL;
114110 }
115111
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);
119114 input_dev = input_allocate_device();
120115 if (!data || !input_dev) {
121116 dev_err(&client->dev, "Failed to allocate memory\n");