Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755397AbbG0DXK (ORCPT ); Sun, 26 Jul 2015 23:23:10 -0400 Received: from mail-pa0-f52.google.com ([209.85.220.52]:34418 "EHLO mail-pa0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753517AbbG0DXI (ORCPT ); Sun, 26 Jul 2015 23:23:08 -0400 Date: Mon, 27 Jul 2015 08:53:01 +0530 From: Vaishali Thakkar To: Linus Walleij Cc: Arnd Bergmann , Paul Gortmaker , Axel Lin , linux-kernel@vger.kernel.org Subject: [PATCH] soc: versatile: Use devm_kzalloc Message-ID: <20150727032301.GA5637@vaishali-Ideapad-Z570> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1951 Lines: 52 This patch introduces the use of devm_kzalloc and does away with kfree in the probe function. Signed-off-by: Vaishali Thakkar --- 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 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/