aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/watchdog/riowd.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/watchdog/riowd.c')
-rw-r--r--drivers/watchdog/riowd.c8
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
216out_free:
217 kfree(p);
218
219out: 216out:
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}