aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/rtc
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/rtc')
-rw-r--r--drivers/rtc/rtc-pl030.c7
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)
106 if (ret) 106 if (ret)
107 goto err_req; 107 goto err_req;
108 108
109 rtc = kmalloc(sizeof(*rtc), GFP_KERNEL); 109 rtc = devm_kzalloc(&dev->dev, sizeof(*rtc), GFP_KERNEL);
110 if (!rtc) { 110 if (!rtc) {
111 ret = -ENOMEM; 111 ret = -ENOMEM;
112 goto err_rtc; 112 goto err_rtc;
@@ -115,7 +115,7 @@ static int pl030_probe(struct amba_device *dev, const struct amba_id *id)
115 rtc->base = ioremap(dev->res.start, resource_size(&dev->res)); 115 rtc->base = ioremap(dev->res.start, resource_size(&dev->res));
116 if (!rtc->base) { 116 if (!rtc->base) {
117 ret = -ENOMEM; 117 ret = -ENOMEM;
118 goto err_map; 118 goto err_rtc;
119 } 119 }
120 120
121 __raw_writel(0, rtc->base + RTC_CR); 121 __raw_writel(0, rtc->base + RTC_CR);
@@ -141,8 +141,6 @@ static int pl030_probe(struct amba_device *dev, const struct amba_id *id)
141 free_irq(dev->irq[0], rtc); 141 free_irq(dev->irq[0], rtc);
142 err_irq: 142 err_irq:
143 iounmap(rtc->base); 143 iounmap(rtc->base);
144 err_map:
145 kfree(rtc);
146 err_rtc: 144 err_rtc:
147 amba_release_regions(dev); 145 amba_release_regions(dev);
148 err_req: 146 err_req:
@@ -158,7 +156,6 @@ static int pl030_remove(struct amba_device *dev)
158 free_irq(dev->irq[0], rtc); 156 free_irq(dev->irq[0], rtc);
159 rtc_device_unregister(rtc->rtc); 157 rtc_device_unregister(rtc->rtc);
160 iounmap(rtc->base); 158 iounmap(rtc->base);
161 kfree(rtc);
162 amba_release_regions(dev); 159 amba_release_regions(dev);
163 160
164 return 0; 161 return 0;