Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965096AbbHKNzt (ORCPT ); Tue, 11 Aug 2015 09:55:49 -0400 Received: from mail-wi0-f175.google.com ([209.85.212.175]:36339 "EHLO mail-wi0-f175.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S964936AbbHKNzR (ORCPT ); Tue, 11 Aug 2015 09:55:17 -0400 Date: Tue, 11 Aug 2015 14:55:11 +0100 From: Lee Jones To: Inha Song 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 Message-ID: <20150811135511.GH18282@x1> References: <1438911359-26949-1-git-send-email-ideal.song@samsung.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1438911359-26949-1-git-send-email-ideal.song@samsung.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1829 Lines: 48 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] [] (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 > --- > 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/