public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [alsa-devel] [PATCH] mfd: wm8994: Fix NULL pointer exception on missing pdata
@ 2015-06-09 10:18 Inha Song
  2015-06-09 13:56 ` Charles Keepax
  0 siblings, 1 reply; 2+ messages in thread
From: Inha Song @ 2015-06-09 10:18 UTC (permalink / raw)
  To: broonie, lee.jones; +Cc: sameo, patches, alsa-devel, linux-kernel, Inha Song

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] [<c02f1e38>] (wm8994_irq_init) from [<c02f1bd4>] (wm8994_i2c_probe+0x684/0x858)
[    1.476241] [<c02f1bd4>] (wm8994_i2c_probe) from [<c0371c78>] (i2c_device_probe+0x11c/0x17c)

In wm8994-core, we already checked wheter 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 <ideal.song@samsung.com>
---
 drivers/mfd/wm8994-irq.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mfd/wm8994-irq.c b/drivers/mfd/wm8994-irq.c
index a14407e..ec2c891 100644
--- a/drivers/mfd/wm8994-irq.c
+++ b/drivers/mfd/wm8994-irq.c
@@ -193,7 +193,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,
-- 
2.0.0.390.gcb682f8


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [alsa-devel] [PATCH] mfd: wm8994: Fix NULL pointer exception on missing pdata
  2015-06-09 10:18 [alsa-devel] [PATCH] mfd: wm8994: Fix NULL pointer exception on missing pdata Inha Song
@ 2015-06-09 13:56 ` Charles Keepax
  0 siblings, 0 replies; 2+ messages in thread
From: Charles Keepax @ 2015-06-09 13:56 UTC (permalink / raw)
  To: Inha Song; +Cc: broonie, lee.jones, alsa-devel, patches, sameo, linux-kernel

On Tue, Jun 09, 2015 at 07:18:32PM +0900, Inha Song wrote:
> 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] [<c02f1e38>] (wm8994_irq_init) from [<c02f1bd4>] (wm8994_i2c_probe+0x684/0x858)
> [    1.476241] [<c02f1bd4>] (wm8994_i2c_probe) from [<c0371c78>] (i2c_device_probe+0x11c/0x17c)
> 
> In wm8994-core, we already checked wheter 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 <ideal.song@samsung.com>
> ---

Acked-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>

Thanks,
Charles

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-06-09 13:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-06-09 10:18 [alsa-devel] [PATCH] mfd: wm8994: Fix NULL pointer exception on missing pdata Inha Song
2015-06-09 13:56 ` Charles Keepax

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox