Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1202192 > unrolled thread

[alsa-devel][RESEND PATCH] mfd: wm8994: Fix NULL pointer exception on missing pdata

Started byInha Song <ideal.song@samsung.com>
First post2015-08-07 03:40 +0200
Last post2015-08-11 16:00 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [alsa-devel][RESEND PATCH] mfd: wm8994: Fix NULL pointer exception on  missing pdata Inha Song <ideal.song@samsung.com> - 2015-08-07 03:40 +0200
    Re: [alsa-devel][RESEND PATCH] mfd: wm8994: Fix NULL pointer  exception on missing pdata Lee Jones <lee.jones@linaro.org> - 2015-08-11 16:00 +0200

#1202192 — [alsa-devel][RESEND PATCH] mfd: wm8994: Fix NULL pointer exception on missing pdata

FromInha Song <ideal.song@samsung.com>
Date2015-08-07 03:40 +0200
Subject[alsa-devel][RESEND PATCH] mfd: wm8994: Fix NULL pointer exception on missing pdata
Message-ID<pUENA-1kn-5@gated-at.bofh.it>
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 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 <ideal.song@samsung.com>
Acked-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.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 55c380a..55c59d9 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

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1205159 — Re: [alsa-devel][RESEND PATCH] mfd: wm8994: Fix NULL pointer exception on missing pdata

FromLee Jones <lee.jones@linaro.org>
Date2015-08-11 16:00 +0200
SubjectRe: [alsa-devel][RESEND PATCH] mfd: wm8994: Fix NULL pointer exception on missing pdata
Message-ID<pWifU-6UA-23@gated-at.bofh.it>
In reply to#1202192
On Fri, 07 Aug 2015, 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 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 <ideal.song@samsung.com>
> Acked-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
> ---
>  drivers/mfd/wm8994-irq.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Bit late in the day to apply this to -fixes, so I'll apply it for v4.3
instead.

Applied, thanks.

> diff --git a/drivers/mfd/wm8994-irq.c b/drivers/mfd/wm8994-irq.c
> index 55c380a..55c59d9 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,

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web