diff options
Diffstat (limited to 'drivers/gpio/pca953x.c')
-rw-r--r-- | drivers/gpio/pca953x.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/drivers/gpio/pca953x.c b/drivers/gpio/pca953x.c index b473429eee75..2fc25dec7cf5 100644 --- a/drivers/gpio/pca953x.c +++ b/drivers/gpio/pca953x.c | |||
@@ -462,7 +462,8 @@ pca953x_get_alt_pdata(struct i2c_client *client) | |||
462 | { | 462 | { |
463 | struct pca953x_platform_data *pdata; | 463 | struct pca953x_platform_data *pdata; |
464 | struct device_node *node; | 464 | struct device_node *node; |
465 | const uint16_t *val; | 465 | const __be32 *val; |
466 | int size; | ||
466 | 467 | ||
467 | node = client->dev.of_node; | 468 | node = client->dev.of_node; |
468 | if (node == NULL) | 469 | if (node == NULL) |
@@ -475,13 +476,13 @@ pca953x_get_alt_pdata(struct i2c_client *client) | |||
475 | } | 476 | } |
476 | 477 | ||
477 | pdata->gpio_base = -1; | 478 | pdata->gpio_base = -1; |
478 | val = of_get_property(node, "linux,gpio-base", NULL); | 479 | val = of_get_property(node, "linux,gpio-base", &size); |
479 | if (val) { | 480 | if (val) { |
480 | if (*val < 0) | 481 | if (size != sizeof(*val)) |
481 | dev_warn(&client->dev, | 482 | dev_warn(&client->dev, "%s: wrong linux,gpio-base\n", |
482 | "invalid gpio-base in device tree\n"); | 483 | node->full_name); |
483 | else | 484 | else |
484 | pdata->gpio_base = *val; | 485 | pdata->gpio_base = be32_to_cpup(val); |
485 | } | 486 | } |
486 | 487 | ||
487 | val = of_get_property(node, "polarity", NULL); | 488 | val = of_get_property(node, "polarity", NULL); |