mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Vaishali Thakkar <vthakkar1994@gmail.com>
To: Linus Walleij <linus.walleij@linaro.org>
Cc: Arnd Bergmann <arnd@arndb.de>,
	Paul Gortmaker <paul.gortmaker@windriver.com>,
	Axel Lin <axel.lin@ingics.com>,
	linux-kernel@vger.kernel.org
Subject: [PATCH] soc: versatile: Use devm_kzalloc
Date: Mon, 27 Jul 2015 08:53:01 +0530	[thread overview]
Message-ID: <20150727032301.GA5637@vaishali-Ideapad-Z570> (raw)

This patch introduces the use of devm_kzalloc and does away
with kfree in the probe function.

Signed-off-by: Vaishali Thakkar <vthakkar1994@gmail.com>
---
Some comments on this patch and driver:
- Here, after this change there will be a kfree on the failure of
  the regmap_read too. I am not sure if driver is currently missing
  it or there is something else happening here. Also, I think there
  should be soc_device_unregister under the regmap_read.
- Moreover, get_maintainer.pl is not pointing me towards any particular
  mailing list or maintainers. So, I am sending this patch to all
  commiters as there are only three commits for this driver.
---
 drivers/soc/versatile/soc-realview.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/soc/versatile/soc-realview.c b/drivers/soc/versatile/soc-realview.c
index e642c45..0889710 100644
--- a/drivers/soc/versatile/soc-realview.c
+++ b/drivers/soc/versatile/soc-realview.c
@@ -103,7 +103,8 @@ static int realview_soc_probe(struct platform_device *pdev)
 	if (IS_ERR(syscon_regmap))
 		return PTR_ERR(syscon_regmap);
 
-	soc_dev_attr = kzalloc(sizeof(*soc_dev_attr), GFP_KERNEL);
+	soc_dev_attr = devm_kzalloc(&pdev->dev, sizeof(*soc_dev_attr),
+				    GFP_KERNEL);
 	if (!soc_dev_attr)
 		return -ENOMEM;
 
@@ -115,10 +116,9 @@ static int realview_soc_probe(struct platform_device *pdev)
 	soc_dev_attr->machine = "RealView";
 	soc_dev_attr->family = "Versatile";
 	soc_dev = soc_device_register(soc_dev_attr);
-	if (IS_ERR(soc_dev)) {
-		kfree(soc_dev_attr);
+	if (IS_ERR(soc_dev))
 		return -ENODEV;
-	}
+
 	ret = regmap_read(syscon_regmap, REALVIEW_SYS_ID_OFFSET,
 			  &realview_coreid);
 	if (ret)
-- 
1.9.1


             reply	other threads:[~2015-07-27  3:23 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-27  3:23 Vaishali Thakkar [this message]
2015-07-28 12:05 ` Linus Walleij
     [not found]   ` <CAK-LDbKW2P3Q-ZPnxu-EkMu+CRp=FxT-4ABrfmpGxonG47HM0A@mail.gmail.com>
2015-07-29  8:30     ` Linus Walleij
2015-07-30  2:46       ` Vaishali Thakkar

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=20150727032301.GA5637@vaishali-Ideapad-Z570 \
    --to=vthakkar1994@gmail.com \
    --cc=arnd@arndb.de \
    --cc=axel.lin@ingics.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=paul.gortmaker@windriver.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®