linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/6] gpio: adp5520: use devm_kzalloc()
@ 2013-03-15  9:14 Jingoo Han
  2013-03-15  9:14 ` [PATCH 2/6] gpio: max7300: " Jingoo Han
                   ` (5 more replies)
  0 siblings, 6 replies; 12+ messages in thread
From: Jingoo Han @ 2013-03-15  9:14 UTC (permalink / raw)
  To: 'Grant Likely'
  Cc: 'Linus Walleij', linux-kernel, 'Jingoo Han'

Use devm_kzalloc() to make cleanup paths simpler.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
---
 drivers/gpio/gpio-adp5520.c |    4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)

diff --git a/drivers/gpio/gpio-adp5520.c b/drivers/gpio/gpio-adp5520.c
index 8afa95f..f33f78d 100644
--- a/drivers/gpio/gpio-adp5520.c
+++ b/drivers/gpio/gpio-adp5520.c
@@ -105,7 +105,7 @@ static int adp5520_gpio_probe(struct platform_device *pdev)
 		return -ENODEV;
 	}
 
-	dev = kzalloc(sizeof(*dev), GFP_KERNEL);
+	dev = devm_kzalloc(&pdev->dev, sizeof(*dev), GFP_KERNEL);
 	if (dev == NULL) {
 		dev_err(&pdev->dev, "failed to alloc memory\n");
 		return -ENOMEM;
@@ -163,7 +163,6 @@ static int adp5520_gpio_probe(struct platform_device *pdev)
 	return 0;
 
 err:
-	kfree(dev);
 	return ret;
 }
 
@@ -180,7 +179,6 @@ static int adp5520_gpio_remove(struct platform_device *pdev)
 		return ret;
 	}
 
-	kfree(dev);
 	return 0;
 }
 
-- 
1.7.2.5



^ permalink raw reply related	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2013-03-27  8:53 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-03-15  9:14 [PATCH 1/6] gpio: adp5520: use devm_kzalloc() Jingoo Han
2013-03-15  9:14 ` [PATCH 2/6] gpio: max7300: " Jingoo Han
2013-03-27  8:47   ` Linus Walleij
2013-03-15  9:15 ` [PATCH 3/6] gpio: max7301: " Jingoo Han
2013-03-27  8:48   ` Linus Walleij
2013-03-15  9:15 ` [PATCH 4/6] gpio: max732x: " Jingoo Han
2013-03-27  8:49   ` Linus Walleij
2013-03-15  9:15 ` [PATCH 5/6] gpio: mc33880: " Jingoo Han
2013-03-27  8:50   ` Linus Walleij
2013-03-15  9:16 ` [PATCH 6/6] gpio: pcf857x: " Jingoo Han
2013-03-27  8:52   ` Linus Walleij
2013-03-27  8:46 ` [PATCH 1/6] gpio: adp5520: " Linus Walleij

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).