diff options
author | Tomasz Figa <t.figa@samsung.com> | 2013-05-24 18:55:35 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-05-24 19:22:53 -0400 |
commit | 43c523bff7c3b47506d536c10637be8399dfd85f (patch) | |
tree | 8d42a0a165fde104013254cfcfcdee74fb612797 /drivers/rtc | |
parent | b4ca2b4b577c3530e34dcfaafccb2cc680ce95d1 (diff) |
drivers/rtc/rtc-max8998.c: check for pdata presence before dereferencing
Currently the driver can crash with a NULL pointer dereference if no
pdata is provided, despite of successful registration of the MFD part.
This patch fixes the problem by adding a NULL check before dereferencing
the pdata pointer.
Signed-off-by: Tomasz Figa <t.figa@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Cc: Sachin Kamat <sachin.kamat@linaro.org>
Reviewed-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/rtc')
-rw-r--r-- | drivers/rtc/rtc-max8998.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/rtc/rtc-max8998.c b/drivers/rtc/rtc-max8998.c index 48b6612fae7f..d5af7baa48b5 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) | |||
285 | info->irq, ret); | 285 | info->irq, ret); |
286 | 286 | ||
287 | dev_info(&pdev->dev, "RTC CHIP NAME: %s\n", pdev->id_entry->name); | 287 | dev_info(&pdev->dev, "RTC CHIP NAME: %s\n", pdev->id_entry->name); |
288 | if (pdata->rtc_delay) { | 288 | if (pdata && pdata->rtc_delay) { |
289 | info->lp3974_bug_workaround = true; | 289 | info->lp3974_bug_workaround = true; |
290 | dev_warn(&pdev->dev, "LP3974 with RTC REGERR option." | 290 | dev_warn(&pdev->dev, "LP3974 with RTC REGERR option." |
291 | " RTC updates will be extremely slow.\n"); | 291 | " RTC updates will be extremely slow.\n"); |