aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/sysdev
diff options
context:
space:
mode:
authorChristophe Leroy <christophe.leroy@c-s.fr>2017-05-24 10:01:55 +0200
committerMichael Ellerman <mpe@ellerman.id.au>2017-06-01 19:54:41 +1000
commit6f553912eedafae13ff20b322a65e471fe7f5236 (patch)
tree6ee4f4ebd6a9c8158bee3e47265cf930a8ad8f70 /arch/powerpc/sysdev
parentpowerpc/spufs: Fix coredump of SPU contexts (diff)
downloadlinux-dev-6f553912eedafae13ff20b322a65e471fe7f5236.tar.xz
linux-dev-6f553912eedafae13ff20b322a65e471fe7f5236.zip
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>
Diffstat (limited to 'arch/powerpc/sysdev')
-rw-r--r--arch/powerpc/sysdev/simple_gpio.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/arch/powerpc/sysdev/simple_gpio.c b/arch/powerpc/sysdev/simple_gpio.c
index ef470b470b04..6afddae2fb47 100644
--- a/arch/powerpc/sysdev/simple_gpio.c
+++ b/arch/powerpc/sysdev/simple_gpio.c
@@ -75,7 +75,8 @@ static int u8_gpio_dir_out(struct gpio_chip *gc, unsigned int gpio, int val)
static void u8_gpio_save_regs(struct of_mm_gpio_chip *mm_gc)
{
- struct u8_gpio_chip *u8_gc = gpiochip_get_data(&mm_gc->gc);
+ struct u8_gpio_chip *u8_gc =
+ container_of(mm_gc, struct u8_gpio_chip, mm_gc);
u8_gc->data = in_8(mm_gc->regs);
}