mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Lee Jones <lee.jones@linaro.org>
To: linux-kernel@vger.kernel.org, sameo@linux.intel.com
Cc: Lee Jones <lee.jones@linaro.org>
Subject: [PATCH 12/16] mfd: htc-i2cpld: Convert to managed resources for allocating memory
Date: Thu, 23 May 2013 16:25:13 +0100	[thread overview]
Message-ID: <1369322717-30429-12-git-send-email-lee.jones@linaro.org> (raw)
In-Reply-To: <1369322717-30429-1-git-send-email-lee.jones@linaro.org>

Signed-off-by: Lee Jones <lee.jones@linaro.org>
---
 drivers/mfd/htc-i2cpld.c |   15 +++++----------
 1 file changed, 5 insertions(+), 10 deletions(-)

diff --git a/drivers/mfd/htc-i2cpld.c b/drivers/mfd/htc-i2cpld.c
index 324187c..c9dfce6 100644
--- a/drivers/mfd/htc-i2cpld.c
+++ b/drivers/mfd/htc-i2cpld.c
@@ -514,8 +514,8 @@ static int htcpld_setup_chips(struct platform_device *pdev)
 
 	/* Setup each chip's output GPIOs */
 	htcpld->nchips = pdata->num_chip;
-	htcpld->chip = kzalloc(sizeof(struct htcpld_chip) * htcpld->nchips,
-			       GFP_KERNEL);
+	htcpld->chip = devm_kzalloc(dev, sizeof(struct htcpld_chip) * htcpld->nchips,
+				    GFP_KERNEL);
 	if (!htcpld->chip) {
 		dev_warn(dev, "Unable to allocate memory for chips\n");
 		return -ENOMEM;
@@ -580,12 +580,11 @@ static int htcpld_core_probe(struct platform_device *pdev)
 		return -ENXIO;
 	}
 
-	htcpld = kzalloc(sizeof(struct htcpld_data), GFP_KERNEL);
+	htcpld = devm_kzalloc(dev, sizeof(struct htcpld_data), GFP_KERNEL);
 	if (!htcpld)
 		return -ENOMEM;
 
 	/* Find chained irq */
-	ret = -EINVAL;
 	res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
 	if (res) {
 		int flags;
@@ -598,7 +597,7 @@ static int htcpld_core_probe(struct platform_device *pdev)
 					   flags, pdev->name, htcpld);
 		if (ret) {
 			dev_warn(dev, "Unable to setup chained irq handler: %d\n", ret);
-			goto fail;
+			return ret;
 		} else
 			device_init_wakeup(dev, 0);
 	}
@@ -609,7 +608,7 @@ static int htcpld_core_probe(struct platform_device *pdev)
 	/* Setup the htcpld chips */
 	ret = htcpld_setup_chips(pdev);
 	if (ret)
-		goto fail;
+		return ret;
 
 	/* Request the GPIO(s) for the int reset and set them up */
 	if (pdata->int_reset_gpio_hi) {
@@ -644,10 +643,6 @@ static int htcpld_core_probe(struct platform_device *pdev)
 
 	dev_info(dev, "Initialized successfully\n");
 	return 0;
-
-fail:
-	kfree(htcpld);
-	return ret;
 }
 
 /* The I2C Driver -- used internally */
-- 
1.7.10.4


  parent reply	other threads:[~2013-05-23 15:25 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-23 15:25 [PATCH 01/16] mfd: tps65912: " Lee Jones
2013-05-23 15:25 ` [PATCH 02/16] mfd: 88pm860x: " Lee Jones
2013-05-23 15:25 ` [PATCH 03/16] mfd: ab3100-otp: " Lee Jones
2013-05-23 15:25 ` [PATCH 04/16] mfd: ab8500-debug: " Lee Jones
2013-05-23 15:25 ` [PATCH 05/16] mfd: ab8500-gpadc: " Lee Jones
2013-05-23 15:25 ` [PATCH 06/16] mfd: abx500-core: " Lee Jones
2013-05-23 15:25 ` [PATCH 07/16] mfd: adp5520: " Lee Jones
2013-05-23 15:25 ` [PATCH 08/16] mfd: asic3: " Lee Jones
2013-05-23 15:25 ` [PATCH 09/16] mfd: cros_ec: " Lee Jones
2013-05-23 15:25 ` [PATCH 10/16] mfd: davinci_voicecodec: " Lee Jones
2013-05-23 15:25 ` [PATCH 11/16] mfd: htc-egpio: " Lee Jones
2013-05-23 15:25 ` Lee Jones [this message]
2013-05-23 15:25 ` [PATCH 13/16] mfd: htc-pasic3: " Lee Jones
2013-05-23 15:25 ` [PATCH 14/16] mfd: janz-cmodio: " Lee Jones
2013-05-23 15:25 ` [PATCH 15/16] mfd: max77686: " Lee Jones
2013-05-23 15:25 ` [PATCH 16/16] mfd: max8925: " Lee Jones
2013-06-11 18:19 ` [PATCH 01/16] mfd: tps65912: " Samuel Ortiz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1369322717-30429-12-git-send-email-lee.jones@linaro.org \
    --to=lee.jones@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sameo@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®