From mboxrd@z Thu Jan 1 00:00:00 1970 From: tomasz.figa@gmail.com (Tomasz Figa) Date: Mon, 20 May 2013 22:05:33 +0200 Subject: [PATCH] rtc: max8998: Check for pdata presence before dereferencing In-Reply-To: <1368630968-30460-1-git-send-email-t.figa@samsung.com> References: <1368630968-30460-1-git-send-email-t.figa@samsung.com> Message-ID: <5315595.u903qx3Wqg@flatron> To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org Hi Alessandro, On Wednesday 15 of May 2013 17:16:08 Tomasz Figa wrote: > Currently the driver can crash with a NULL pointer dereference if no > pdata is provided, despite of successful registration of MFD part. This > patch fixes the problem by adding a NULL check before dereferencing the > pdata pointer. > > Signed-off-by: Tomasz Figa > Signed-off-by: Kyungmin Park > --- > drivers/rtc/rtc-max8998.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/rtc/rtc-max8998.c b/drivers/rtc/rtc-max8998.c > index 48b6612..d5af7ba 100644 > --- a/drivers/rtc/rtc-max8998.c > +++ b/drivers/rtc/rtc-max8998.c > @@ -285,7 +285,7 @@ static int max8998_rtc_probe(struct platform_device > *pdev) info->irq, ret); > > dev_info(&pdev->dev, "RTC CHIP NAME: %s\n", pdev->id_entry->name); > - if (pdata->rtc_delay) { > + if (pdata && pdata->rtc_delay) { > info->lp3974_bug_workaround = true; > dev_warn(&pdev->dev, "LP3974 with RTC REGERR option." > " RTC updates will be extremely slow.\n"); Since this is a fix, could you apply this patch to your fixes branch for 3.10-rc2, please? Best regards, Tomasz