powerpc/sysdev/simple_gpio: Fix oops in gpio save_regs function
authorChristophe Leroy <christophe.leroy@c-s.fr>
Wed, 24 May 2017 08:01:55 +0000 (10:01 +0200)
committerMichael Ellerman <mpe@ellerman.id.au>
Thu, 1 Jun 2017 09:54:41 +0000 (19:54 +1000)
commit6f553912eedafae13ff20b322a65e471fe7f5236
tree6ee4f4ebd6a9c8158bee3e47265cf930a8ad8f70
parent99acc9bede06bbb2662aafff51f5b9e529fa845e
powerpc/sysdev/simple_gpio: Fix oops in gpio save_regs function

of_mm_gpiochip_add_data() generates an oops for NULL pointer dereference.

of_mm_gpiochip_add_data() calls mm_gc->save_regs() before
setting the data, therefore ->save_regs() cannot use gpiochip_get_data()

Fixes: 937daafca774 ("powerpc: simple-gpio: use gpiochip data pointer")
Cc: stable@vger.kernel.org # v4.7+
Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
arch/powerpc/sysdev/simple_gpio.c