Skip to content

Commit

Permalink
Input: goodix - fix variable length array warning
Browse files Browse the repository at this point in the history
Fix sparse warning:

drivers/input/touchscreen/goodix.c:182:26: warning: Variable length array is used.

Replace the variable length array with fixed length.

Some Goodix devices have maximum 5 touch points, while others have 10 touch
points. Using the maximum length (80 bytes) for all devices will lead to
wasting 40 bytes on stack when using devices with maximum 5 touch points.
However, that is preferable to using kmalloc which will use even more
resources.

Signed-off-by: Irina Tirdea <[email protected]>
Acked-by: Bastien Nocera <[email protected]>
Signed-off-by: Dmitry Torokhov <[email protected]>
  • Loading branch information
itirdea authored and dtor committed Jun 9, 2015
1 parent 0dfb35b commit 0e0432f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/input/touchscreen/goodix.c
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ static void goodix_ts_report_touch(struct goodix_ts_data *ts, u8 *coor_data)
*/
static void goodix_process_events(struct goodix_ts_data *ts)
{
u8 point_data[1 + GOODIX_CONTACT_SIZE * ts->max_touch_num];
u8 point_data[1 + GOODIX_CONTACT_SIZE * GOODIX_MAX_CONTACTS];
int touch_num;
int i;

Expand Down

0 comments on commit 0e0432f

Please sign in to comment.