diff options
author | Jingoo Han <jg1.han@samsung.com> | 2013-04-30 01:01:59 -0400 |
---|---|---|
committer | Wim Van Sebroeck <wim@iguana.be> | 2013-07-11 14:56:47 -0400 |
commit | a508e2e634f9ea462c3beb56e12aa50ba9e8b0a9 (patch) | |
tree | 63686684b9bc801c0fcb41f2a5cc2b098ae2dfff /drivers/watchdog | |
parent | 52ccc5aca4c9cf35974c1ea3b53fc43044b29361 (diff) |
watchdog: riowd: use devm_kzalloc()
Use devm_kzalloc() to make cleanup paths simpler.
Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
Diffstat (limited to 'drivers/watchdog')
-rw-r--r-- | drivers/watchdog/riowd.c | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/drivers/watchdog/riowd.c b/drivers/watchdog/riowd.c index 0040451aec1d..13363adc364f 100644 --- a/drivers/watchdog/riowd.c +++ b/drivers/watchdog/riowd.c | |||
@@ -183,7 +183,7 @@ static int riowd_probe(struct platform_device *op) | |||
183 | goto out; | 183 | goto out; |
184 | 184 | ||
185 | err = -ENOMEM; | 185 | err = -ENOMEM; |
186 | p = kzalloc(sizeof(*p), GFP_KERNEL); | 186 | p = devm_kzalloc(&op->dev, sizeof(*p), GFP_KERNEL); |
187 | if (!p) | 187 | if (!p) |
188 | goto out; | 188 | goto out; |
189 | 189 | ||
@@ -192,7 +192,7 @@ static int riowd_probe(struct platform_device *op) | |||
192 | p->regs = of_ioremap(&op->resource[0], 0, 2, DRIVER_NAME); | 192 | p->regs = of_ioremap(&op->resource[0], 0, 2, DRIVER_NAME); |
193 | if (!p->regs) { | 193 | if (!p->regs) { |
194 | pr_err("Cannot map registers\n"); | 194 | pr_err("Cannot map registers\n"); |
195 | goto out_free; | 195 | goto out; |
196 | } | 196 | } |
197 | /* Make miscdev useable right away */ | 197 | /* Make miscdev useable right away */ |
198 | riowd_device = p; | 198 | riowd_device = p; |
@@ -213,9 +213,6 @@ out_iounmap: | |||
213 | riowd_device = NULL; | 213 | riowd_device = NULL; |
214 | of_iounmap(&op->resource[0], p->regs, 2); | 214 | of_iounmap(&op->resource[0], p->regs, 2); |
215 | 215 | ||
216 | out_free: | ||
217 | kfree(p); | ||
218 | |||
219 | out: | 216 | out: |
220 | return err; | 217 | return err; |
221 | } | 218 | } |
@@ -226,7 +223,6 @@ static int riowd_remove(struct platform_device *op) | |||
226 | 223 | ||
227 | misc_deregister(&riowd_miscdev); | 224 | misc_deregister(&riowd_miscdev); |
228 | of_iounmap(&op->resource[0], p->regs, 2); | 225 | of_iounmap(&op->resource[0], p->regs, 2); |
229 | kfree(p); | ||
230 | 226 | ||
231 | return 0; | 227 | return 0; |
232 | } | 228 | } |