提交 431c6c1d 编写于 作者: J Jingoo Han 提交者: Linus Torvalds

rtc: rtc-v3020: use devm_*() functions

Use devm_*() functions to make cleanup paths simpler.
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>
上级 87a81420
...@@ -309,7 +309,7 @@ static int rtc_probe(struct platform_device *pdev) ...@@ -309,7 +309,7 @@ static int rtc_probe(struct platform_device *pdev)
int i; int i;
int temp; int temp;
chip = kzalloc(sizeof *chip, GFP_KERNEL); chip = devm_kzalloc(&pdev->dev, sizeof(*chip), GFP_KERNEL);
if (!chip) if (!chip)
return -ENOMEM; return -ENOMEM;
...@@ -353,8 +353,8 @@ static int rtc_probe(struct platform_device *pdev) ...@@ -353,8 +353,8 @@ static int rtc_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, chip); platform_set_drvdata(pdev, chip);
chip->rtc = rtc_device_register("v3020", chip->rtc = devm_rtc_device_register(&pdev->dev, "v3020",
&pdev->dev, &v3020_rtc_ops, THIS_MODULE); &v3020_rtc_ops, THIS_MODULE);
if (IS_ERR(chip->rtc)) { if (IS_ERR(chip->rtc)) {
retval = PTR_ERR(chip->rtc); retval = PTR_ERR(chip->rtc);
goto err_io; goto err_io;
...@@ -365,21 +365,14 @@ static int rtc_probe(struct platform_device *pdev) ...@@ -365,21 +365,14 @@ static int rtc_probe(struct platform_device *pdev)
err_io: err_io:
chip->ops->unmap_io(chip); chip->ops->unmap_io(chip);
err_chip: err_chip:
kfree(chip);
return retval; return retval;
} }
static int rtc_remove(struct platform_device *dev) static int rtc_remove(struct platform_device *dev)
{ {
struct v3020 *chip = platform_get_drvdata(dev); struct v3020 *chip = platform_get_drvdata(dev);
struct rtc_device *rtc = chip->rtc;
if (rtc)
rtc_device_unregister(rtc);
chip->ops->unmap_io(chip); chip->ops->unmap_io(chip);
kfree(chip);
return 0; return 0;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册