diff options
author | Jingoo Han <jg1.han@samsung.com> | 2013-04-29 16:20:56 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-04-29 18:28:39 -0700 |
commit | 431c6c1df36d1511d48ccbd38b9561a486142d42 (patch) | |
tree | 2079bc2036a743153920b02884e3736bb7d09224 /drivers/rtc | |
parent | 87a81420873d031dc387c6d1c8cefa067b539fa2 (diff) | |
download | blackbird-op-linux-431c6c1df36d1511d48ccbd38b9561a486142d42.tar.gz blackbird-op-linux-431c6c1df36d1511d48ccbd38b9561a486142d42.zip |
rtc: rtc-v3020: use devm_*() functions
Use devm_*() functions to make cleanup paths simpler.
Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/rtc')
-rw-r--r-- | drivers/rtc/rtc-v3020.c | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/drivers/rtc/rtc-v3020.c b/drivers/rtc/rtc-v3020.c index bca5d677bc85..6e0cba8f47d5 100644 --- a/drivers/rtc/rtc-v3020.c +++ b/drivers/rtc/rtc-v3020.c @@ -309,7 +309,7 @@ static int rtc_probe(struct platform_device *pdev) int i; int temp; - chip = kzalloc(sizeof *chip, GFP_KERNEL); + chip = devm_kzalloc(&pdev->dev, sizeof(*chip), GFP_KERNEL); if (!chip) return -ENOMEM; @@ -353,8 +353,8 @@ static int rtc_probe(struct platform_device *pdev) platform_set_drvdata(pdev, chip); - chip->rtc = rtc_device_register("v3020", - &pdev->dev, &v3020_rtc_ops, THIS_MODULE); + chip->rtc = devm_rtc_device_register(&pdev->dev, "v3020", + &v3020_rtc_ops, THIS_MODULE); if (IS_ERR(chip->rtc)) { retval = PTR_ERR(chip->rtc); goto err_io; @@ -365,21 +365,14 @@ static int rtc_probe(struct platform_device *pdev) err_io: chip->ops->unmap_io(chip); err_chip: - kfree(chip); - return retval; } static int rtc_remove(struct platform_device *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); - kfree(chip); return 0; } |