From: Inha Song Date: Fri, 7 Aug 2015 01:35:59 +0000 (+0900) Subject: mfd: wm8994: Fix NULL pointer exception on missing pdata X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=dd30acc889f586cecdea0d7f401f3dc80752b41e;p=linux-beck.git mfd: wm8994: Fix NULL pointer exception on missing pdata If we use the dev_get_platdata, pdata can be NULL in DT environments. Actually, NULL pointer exception is occurs with error messages like this: [ 1.226583] Unable to handle kernel NULL pointer dereference at virtual address 00000044 [ 1.467910] [] (wm8994_irq_init) from [] (wm8994_i2c_probe+0x684/0x858) [ 1.476241] [] (wm8994_i2c_probe) from [] (i2c_device_probe+0x11c/0x17c) In wm8994-core, we already checked whether platform data is NULL and set the wm8994->pdata to platform data if platform data is not NULL. So, we can use wm8994->pdata instead of platform data. Signed-off-by: Inha Song Acked-by: Charles Keepax Signed-off-by: Lee Jones --- diff --git a/drivers/mfd/wm8994-irq.c b/drivers/mfd/wm8994-irq.c index 6f1427d32a93..18710f3b5c53 100644 --- a/drivers/mfd/wm8994-irq.c +++ b/drivers/mfd/wm8994-irq.c @@ -186,7 +186,7 @@ int wm8994_irq_init(struct wm8994 *wm8994) { int ret; unsigned long irqflags; - struct wm8994_pdata *pdata = dev_get_platdata(wm8994->dev); + struct wm8994_pdata *pdata = &wm8994->pdata; if (!wm8994->irq) { dev_warn(wm8994->dev,