diff options
author | Sangjung Woo <sangjung.woo@samsung.com> | 2013-11-13 03:11:02 +0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-11-13 07:09:31 +0400 |
commit | 58c181c8255b8f23c5772b4c4d2328450a95081f (patch) | |
tree | 11e81d53df4782cdf7002853d21cdf918c1deb6f /drivers/rtc | |
parent | 1fbc4c4d79e63709b919bc1a72e991c29ea13f4c (diff) | |
download | linux-58c181c8255b8f23c5772b4c4d2328450a95081f.tar.xz |
drivers/rtc/rtc-pl030.c: use devm_kzalloc() instead of kmalloc()
In order to be free automatically and make the cleanup paths more simple,
use devm_kzalloc() instead of kmalloc().
Signed-off-by: Sangjung Woo <sangjung.woo@samsung.com>
Cc: Joe Perches <joe@perches.com>
Cc: Alessandro Zummo <a.zummo@towertech.it>
Cc: Russell King <rmk+kernel@arm.linux.org.uk>
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-pl030.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/drivers/rtc/rtc-pl030.c b/drivers/rtc/rtc-pl030.c index a804f758ac6d..f85a1a93e669 100644 --- a/drivers/rtc/rtc-pl030.c +++ b/drivers/rtc/rtc-pl030.c @@ -106,7 +106,7 @@ static int pl030_probe(struct amba_device *dev, const struct amba_id *id) if (ret) goto err_req; - rtc = kmalloc(sizeof(*rtc), GFP_KERNEL); + rtc = devm_kzalloc(&dev->dev, sizeof(*rtc), GFP_KERNEL); if (!rtc) { ret = -ENOMEM; goto err_rtc; @@ -115,7 +115,7 @@ static int pl030_probe(struct amba_device *dev, const struct amba_id *id) rtc->base = ioremap(dev->res.start, resource_size(&dev->res)); if (!rtc->base) { ret = -ENOMEM; - goto err_map; + goto err_rtc; } __raw_writel(0, rtc->base + RTC_CR); @@ -141,8 +141,6 @@ static int pl030_probe(struct amba_device *dev, const struct amba_id *id) free_irq(dev->irq[0], rtc); err_irq: iounmap(rtc->base); - err_map: - kfree(rtc); err_rtc: amba_release_regions(dev); err_req: @@ -158,7 +156,6 @@ static int pl030_remove(struct amba_device *dev) free_irq(dev->irq[0], rtc); rtc_device_unregister(rtc->rtc); iounmap(rtc->base); - kfree(rtc); amba_release_regions(dev); return 0; |