diff options
Diffstat (limited to 'drivers/input/keyboard/matrix_keypad.c')
-rw-r--r-- | drivers/input/keyboard/matrix_keypad.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/input/keyboard/matrix_keypad.c b/drivers/input/keyboard/matrix_keypad.c index f4ff0dda7597..71d77192ac1e 100644 --- a/drivers/input/keyboard/matrix_keypad.c +++ b/drivers/input/keyboard/matrix_keypad.c | |||
@@ -403,7 +403,7 @@ matrix_keypad_parse_dt(struct device *dev) | |||
403 | struct matrix_keypad_platform_data *pdata; | 403 | struct matrix_keypad_platform_data *pdata; |
404 | struct device_node *np = dev->of_node; | 404 | struct device_node *np = dev->of_node; |
405 | unsigned int *gpios; | 405 | unsigned int *gpios; |
406 | int i; | 406 | int i, nrow, ncol; |
407 | 407 | ||
408 | if (!np) { | 408 | if (!np) { |
409 | dev_err(dev, "device lacks DT data\n"); | 409 | dev_err(dev, "device lacks DT data\n"); |
@@ -416,9 +416,9 @@ matrix_keypad_parse_dt(struct device *dev) | |||
416 | return ERR_PTR(-ENOMEM); | 416 | return ERR_PTR(-ENOMEM); |
417 | } | 417 | } |
418 | 418 | ||
419 | pdata->num_row_gpios = of_gpio_named_count(np, "row-gpios"); | 419 | pdata->num_row_gpios = nrow = of_gpio_named_count(np, "row-gpios"); |
420 | pdata->num_col_gpios = of_gpio_named_count(np, "col-gpios"); | 420 | pdata->num_col_gpios = ncol = of_gpio_named_count(np, "col-gpios"); |
421 | if (!pdata->num_row_gpios || !pdata->num_col_gpios) { | 421 | if (nrow <= 0 || ncol <= 0) { |
422 | dev_err(dev, "number of keypad rows/columns not specified\n"); | 422 | dev_err(dev, "number of keypad rows/columns not specified\n"); |
423 | return ERR_PTR(-EINVAL); | 423 | return ERR_PTR(-EINVAL); |
424 | } | 424 | } |