diff options
author | Axel Lin <axel.lin@ingics.com> | 2016-09-09 06:03:54 -0400 |
---|---|---|
committer | Alexandre Belloni <alexandre.belloni@free-electrons.com> | 2016-09-21 18:14:41 -0400 |
commit | 473195f80f3940afc8a1461831d74f9a44bba538 (patch) | |
tree | 8807076c4bd088a3923d6b765981f1002e2f701e /drivers/rtc | |
parent | ee85bb5bbe4ae690b48625874bc2b6ecc981326e (diff) |
rtc: ac100: Add NULL checking for devm_kzalloc call
devm_kzalloc can return NULL, add NULL checking to prevent NULL pointer
dereference.
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Diffstat (limited to 'drivers/rtc')
-rw-r--r-- | drivers/rtc/rtc-ac100.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/rtc/rtc-ac100.c b/drivers/rtc/rtc-ac100.c index 2d0bb02a25d9..9e336184491c 100644 --- a/drivers/rtc/rtc-ac100.c +++ b/drivers/rtc/rtc-ac100.c | |||
@@ -554,6 +554,9 @@ static int ac100_rtc_probe(struct platform_device *pdev) | |||
554 | int ret; | 554 | int ret; |
555 | 555 | ||
556 | chip = devm_kzalloc(&pdev->dev, sizeof(*chip), GFP_KERNEL); | 556 | chip = devm_kzalloc(&pdev->dev, sizeof(*chip), GFP_KERNEL); |
557 | if (!chip) | ||
558 | return -ENOMEM; | ||
559 | |||
557 | platform_set_drvdata(pdev, chip); | 560 | platform_set_drvdata(pdev, chip); |
558 | chip->dev = &pdev->dev; | 561 | chip->dev = &pdev->dev; |
559 | chip->regmap = ac100->regmap; | 562 | chip->regmap = ac100->regmap; |