diff options
Diffstat (limited to 'drivers/gpio')
-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 a261972f603d..694b0f9c4b6c 100644 --- a/drivers/gpio/pca953x.c +++ b/drivers/gpio/pca953x.c | |||
@@ -448,7 +448,8 @@ pca953x_get_alt_pdata(struct i2c_client *client) | |||
448 | { | 448 | { |
449 | struct pca953x_platform_data *pdata; | 449 | struct pca953x_platform_data *pdata; |
450 | struct device_node *node; | 450 | struct device_node *node; |
451 | const uint16_t *val; | 451 | const __be32 *val; |
452 | int size; | ||
452 | 453 | ||
453 | node = client->dev.of_node; | 454 | node = client->dev.of_node; |
454 | if (node == NULL) | 455 | if (node == NULL) |
@@ -461,13 +462,13 @@ pca953x_get_alt_pdata(struct i2c_client *client) | |||
461 | } | 462 | } |
462 | 463 | ||
463 | pdata->gpio_base = -1; | 464 | pdata->gpio_base = -1; |
464 | val = of_get_property(node, "linux,gpio-base", NULL); | 465 | val = of_get_property(node, "linux,gpio-base", &size); |
465 | if (val) { | 466 | if (val) { |
466 | if (*val < 0) | 467 | if (size != sizeof(*val)) |
467 | dev_warn(&client->dev, | 468 | dev_warn(&client->dev, "%s: wrong linux,gpio-base\n", |
468 | "invalid gpio-base in device tree\n"); | 469 | node->full_name); |
469 | else | 470 | else |
470 | pdata->gpio_base = *val; | 471 | pdata->gpio_base = be32_to_cpup(val); |
471 | } | 472 | } |
472 | 473 | ||
473 | val = of_get_property(node, "polarity", NULL); | 474 | val = of_get_property(node, "polarity", NULL); |