提交 0f64f853 编写于 作者: J Jingoo Han 提交者: Linus Torvalds

drivers/rtc/rtc-max77686.c: use devm_kzalloc()

Use devm_kzalloc() to make cleanup paths more simple.
Signed-off-by: NJingoo Han <jg1.han@samsung.com>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 f5b1d3c5
...@@ -505,7 +505,8 @@ static int max77686_rtc_probe(struct platform_device *pdev) ...@@ -505,7 +505,8 @@ static int max77686_rtc_probe(struct platform_device *pdev)
dev_info(&pdev->dev, "%s\n", __func__); dev_info(&pdev->dev, "%s\n", __func__);
info = kzalloc(sizeof(struct max77686_rtc_info), GFP_KERNEL); info = devm_kzalloc(&pdev->dev, sizeof(struct max77686_rtc_info),
GFP_KERNEL);
if (!info) if (!info)
return -ENOMEM; return -ENOMEM;
...@@ -519,7 +520,6 @@ static int max77686_rtc_probe(struct platform_device *pdev) ...@@ -519,7 +520,6 @@ static int max77686_rtc_probe(struct platform_device *pdev)
ret = PTR_ERR(info->max77686->rtc_regmap); ret = PTR_ERR(info->max77686->rtc_regmap);
dev_err(info->max77686->dev, "Failed to allocate register map: %d\n", dev_err(info->max77686->dev, "Failed to allocate register map: %d\n",
ret); ret);
kfree(info);
return ret; return ret;
} }
platform_set_drvdata(pdev, info); platform_set_drvdata(pdev, info);
...@@ -563,11 +563,7 @@ static int max77686_rtc_probe(struct platform_device *pdev) ...@@ -563,11 +563,7 @@ static int max77686_rtc_probe(struct platform_device *pdev)
goto err_rtc; goto err_rtc;
} }
goto out;
err_rtc: err_rtc:
kfree(info);
return ret;
out:
return ret; return ret;
} }
...@@ -578,7 +574,6 @@ static int max77686_rtc_remove(struct platform_device *pdev) ...@@ -578,7 +574,6 @@ static int max77686_rtc_remove(struct platform_device *pdev)
if (info) { if (info) {
free_irq(info->virq, info); free_irq(info->virq, info);
rtc_device_unregister(info->rtc_dev); rtc_device_unregister(info->rtc_dev);
kfree(info);
} }
return 0; return 0;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册