From: Axel Lin Date: Fri, 9 Sep 2016 10:03:54 +0000 (+0800) Subject: rtc: ac100: Add NULL checking for devm_kzalloc call X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=473195f80f3940afc8a1461831d74f9a44bba538;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git 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 Signed-off-by: Alexandre Belloni --- 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) int ret; chip = devm_kzalloc(&pdev->dev, sizeof(*chip), GFP_KERNEL); + if (!chip) + return -ENOMEM; + platform_set_drvdata(pdev, chip); chip->dev = &pdev->dev; chip->regmap = ac100->regmap;