diff options
Diffstat (limited to 'drivers/auxdisplay')
-rw-r--r-- | drivers/auxdisplay/ht16k33.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/drivers/auxdisplay/ht16k33.c b/drivers/auxdisplay/ht16k33.c index f66b45b235b0..ba6370974574 100644 --- a/drivers/auxdisplay/ht16k33.c +++ b/drivers/auxdisplay/ht16k33.c | |||
@@ -278,7 +278,7 @@ static bool ht16k33_keypad_scan(struct ht16k33_keypad *keypad) | |||
278 | } | 278 | } |
279 | } | 279 | } |
280 | input_sync(keypad->dev); | 280 | input_sync(keypad->dev); |
281 | memcpy(keypad->last_key_state, new_state, sizeof(new_state)); | 281 | memcpy(keypad->last_key_state, new_state, sizeof(u16) * keypad->cols); |
282 | 282 | ||
283 | return pressed; | 283 | return pressed; |
284 | } | 284 | } |
@@ -353,6 +353,12 @@ static int ht16k33_keypad_probe(struct i2c_client *client, | |||
353 | err = matrix_keypad_parse_of_params(&client->dev, &rows, &cols); | 353 | err = matrix_keypad_parse_of_params(&client->dev, &rows, &cols); |
354 | if (err) | 354 | if (err) |
355 | return err; | 355 | return err; |
356 | if (rows > HT16K33_MATRIX_KEYPAD_MAX_ROWS || | ||
357 | cols > HT16K33_MATRIX_KEYPAD_MAX_COLS) { | ||
358 | dev_err(&client->dev, "%u rows or %u cols out of range in DT\n", | ||
359 | rows, cols); | ||
360 | return -ERANGE; | ||
361 | } | ||
356 | 362 | ||
357 | keypad->rows = rows; | 363 | keypad->rows = rows; |
358 | keypad->cols = cols; | 364 | keypad->cols = cols; |