[PATCH 4.4.y-cip] gpio: rcar: Avoid NULL pointer access in gpio_rcar_set_multiple()

Lad Prabhakar

gpiochip_get_data() expects the controller probe to call
gpiochip_add_data() before using it, where as the rcar-gpio
driver probe has gpiochip_add() call thus resulting in NULL
pointer access.

Avoid this case by using gpio_to_priv() call.

Fixes: 6e52cced1aa58 ("gpio: rcar: Implement gpiochip.set_multiple()")
Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@...>
drivers/gpio/gpio-rcar.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpio/gpio-rcar.c b/drivers/gpio/gpio-rcar.c
index e829f11aca8f..2778dcd96ae7 100644
--- a/drivers/gpio/gpio-rcar.c
+++ b/drivers/gpio/gpio-rcar.c
@@ -352,7 +352,7 @@ static void gpio_rcar_set(struct gpio_chip *chip, unsigned offset, int value)
static void gpio_rcar_set_multiple(struct gpio_chip *chip, unsigned long *mask,
unsigned long *bits)
- struct gpio_rcar_priv *p = gpiochip_get_data(chip);
+ struct gpio_rcar_priv *p = gpio_to_priv(chip);
unsigned long flags;
u32 val, bankmask;


Join {cip-dev@lists.cip-project.org to automatically receive all group messages.