rtc: max8998: Check for pdata presence before dereferencing
한진구
Reviewed-byQuoted 8 lines · Tomasz Figa
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 <[email protected]>Signed-off-by Kyungmin Park <[email protected]>
CC'ed Andrew Morton
Reviewed-by Jingoo Han <[email protected]>
Best regards,
Jingoo Han
Quoted 24 lines
--- drivers/rtc/rtc-max8998.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/rtc/rtc-max8998.c +1
-2@@ -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" ); --1.8.2.1
--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html