提交 473195f8 编写于 作者: A Axel Lin 提交者: Alexandre Belloni

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: NAxel Lin <axel.lin@ingics.com>
Signed-off-by: NAlexandre Belloni <alexandre.belloni@free-electrons.com>
上级 ee85bb5b
...@@ -554,6 +554,9 @@ static int ac100_rtc_probe(struct platform_device *pdev) ...@@ -554,6 +554,9 @@ static int ac100_rtc_probe(struct platform_device *pdev)
int ret; int ret;
chip = devm_kzalloc(&pdev->dev, sizeof(*chip), GFP_KERNEL); chip = devm_kzalloc(&pdev->dev, sizeof(*chip), GFP_KERNEL);
if (!chip)
return -ENOMEM;
platform_set_drvdata(pdev, chip); platform_set_drvdata(pdev, chip);
chip->dev = &pdev->dev; chip->dev = &pdev->dev;
chip->regmap = ac100->regmap; chip->regmap = ac100->regmap;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册