Message ID | 20140525105825.GA3437@himangi-Dell |
---|---|
State | Superseded |
Delegated to: | David Miller |
Headers | show |
Hi Himangi. On Sun, May 25, 2014 at 04:28:25PM +0530, Himangi Saraogi wrote: > This patch moves data allocated using kzalloc to managed data allocated > using devm_kzalloc and cleans now unnecessary kfrees in probe and remove > functions. The header file is added to make the devm function explicitly > available. This version looks much better. If you in the subject replaces sbus: with display7seg: then you can add my: Acked-by: Sam Ravnborg <sam@ravnborg.org> "sbus:" is very generic, but this patch touches only this single driver. Sam -- To unsubscribe from this list: send the line "unsubscribe sparclinux" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/drivers/sbus/char/display7seg.c b/drivers/sbus/char/display7seg.c index 7c71e7b..b48899c 100644 --- a/drivers/sbus/char/display7seg.c +++ b/drivers/sbus/char/display7seg.c @@ -4,6 +4,7 @@ * Copyright (c) 2000 Eric Brower (ebrower@usa.net) */ +#include <linux/device.h> #include <linux/kernel.h> #include <linux/module.h> #include <linux/fs.h> @@ -180,7 +181,7 @@ static int d7s_probe(struct platform_device *op) if (d7s_device) goto out; - p = kzalloc(sizeof(*p), GFP_KERNEL); + p = devm_kzalloc(&op->dev, sizeof(*p), GFP_KERNEL); err = -ENOMEM; if (!p) goto out; @@ -231,7 +232,6 @@ out_iounmap: of_iounmap(&op->resource[0], p->regs, sizeof(u8)); out_free: - kfree(p); goto out; } @@ -251,7 +251,6 @@ static int d7s_remove(struct platform_device *op) misc_deregister(&d7s_miscdev); of_iounmap(&op->resource[0], p->regs, sizeof(u8)); - kfree(p); return 0; }