public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Lee Jones <lee.jones@linaro.org>
To: Inha Song <ideal.song@samsung.com>
Cc: broonie@kernel.org, sameo@linux.intel.com,
	patches@opensource.wolfsonmicro.com, alsa-devel@alsa-project.org,
	linux-kernel@vger.kernel.org,
	ckeepax@opensource.wolfsonmicro.com
Subject: Re: [alsa-devel][RESEND PATCH] mfd: wm8994: Fix NULL pointer exception on missing pdata
Date: Tue, 11 Aug 2015 14:55:11 +0100	[thread overview]
Message-ID: <20150811135511.GH18282@x1> (raw)
In-Reply-To: <1438911359-26949-1-git-send-email-ideal.song@samsung.com>

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

      reply	other threads:[~2015-08-11 13:55 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-07  1:35 [alsa-devel][RESEND PATCH] mfd: wm8994: Fix NULL pointer exception on missing pdata Inha Song
2015-08-11 13:55 ` Lee Jones [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150811135511.GH18282@x1 \
    --to=lee.jones@linaro.org \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=ckeepax@opensource.wolfsonmicro.com \
    --cc=ideal.song@samsung.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=patches@opensource.wolfsonmicro.com \
    --cc=sameo@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox