From patchwork Sat Apr 13 07:14:21 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicholas Mc Guire X-Patchwork-Id: 10899323 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 842D317EF for ; Sat, 13 Apr 2019 07:21:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5D48B28E89 for ; Sat, 13 Apr 2019 07:21:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5197128E91; Sat, 13 Apr 2019 07:21:19 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 967CD28E89 for ; Sat, 13 Apr 2019 07:21:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=vsFoUkvG2bDC8zzJpv/r8GAeQGvkAe8bq8CHxIUXuH4=; b=mdzElACcRIu4k87IfaLtWfMBef 5+qrTH1Bsppdmy3hRK2IVTSnIDObWYKptG0ZlxmqpBs/Ny/ar+JwLoYOe68GRt3xxAlDCZ9QOnzUI ebdMKf/trZCcVBncne3QLoK38R5/Abo+2jaa6GAqCHvZRvMNAdlYQxjBt3be+LgF9zylVHGhmCxK0 i3B7O2cDKQWGt8G8ZcSXg+KfkAfuP/CczrtBhxzCFzFABDAXvGaL+qZrImRBWvROt0PDMbwBcM/vX h7DFAXu2faxyY5P7s9FPayVh4BIjnPtxhhVUj1DsTH0zZlgkKgtVGJaNLPK18wG3S865A1mE3g8Ne 2otHd8Bg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hFCyP-00045b-B3; Sat, 13 Apr 2019 07:21:13 +0000 Received: from www.osadl.org ([2001:a60:9266:ffff:62:245:132:105]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hFCxz-0003ZS-8P for linux-arm-kernel@lists.infradead.org; Sat, 13 Apr 2019 07:20:49 +0000 Received: from debian01.hofrr.at (178.115.242.59.static.drei.at [178.115.242.59]) by www.osadl.org (8.13.8/8.13.8/OSADL-2007092901) with ESMTP id x3D7JfAX003435; Sat, 13 Apr 2019 09:20:29 +0200 From: Nicholas Mc Guire To: Russell King Subject: [PATCH] ARM: ux500: add missing of_node_put() Date: Sat, 13 Apr 2019 09:14:21 +0200 Message-Id: <1555139666-948-10-git-send-email-hofrat@osadl.org> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1555139666-948-1-git-send-email-hofrat@osadl.org> References: <1555139666-948-1-git-send-email-hofrat@osadl.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190413_002047_591977_922D654F X-CRM114-Status: GOOD ( 13.15 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mike Rapoport , Tony Lindgren , Shawn Guo , Sascha Hauer , Janusz Krzysztofik , linux-kernel@vger.kernel.org, Mark Brown , NXP Linux Team , Pengutronix Kernel Team , Nicholas Mc Guire , Fabio Estevam , Linus Walleij , linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP of_find_compatible_node() returns a pointer with refcount incremented so both in the error path as well as after usage in soc_info_populate() respectively actually b8500_read_soc_id() an explicit of_node_put is needed to release backupram. Signed-off-by: Nicholas Mc Guire Fixes: commit 18a992787896 ("ARM: ux500: move soc_id driver to drivers/soc") Acked-by: Ulf Hansson --- Problem located with experimental cocinelle script get_maintainer.pl only returns linux-kernel@vger.kernel.org for this file ? Is MAINTAINERS entry missing ? Not really sure about the referenced fixes commit 18a992787896 ("ARM: ux500: move soc_id driver to drivers/soc") the commit log notes only that the driver is being moved and not expected to change (v4.8) but looking at the previous version in v4.7 it does seem that while moving the driver there was also a relevant change to the driver code including the switch to using of_find_compatible_node(). Patch was compiletested with: u8500_defconfig (implies ONFIG_UX500_SOC_ID=y) Patch is against 4.18-rc3 (localversion-next is next-20180706) drivers/soc/ux500/ux500-soc-id.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/soc/ux500/ux500-soc-id.c b/drivers/soc/ux500/ux500-soc-id.c index 6c1be74..e22597d 100644 --- a/drivers/soc/ux500/ux500-soc-id.c +++ b/drivers/soc/ux500/ux500-soc-id.c @@ -203,10 +203,13 @@ static int __init ux500_soc_device_init(void) ux500_setup_id(); soc_dev_attr = kzalloc(sizeof(*soc_dev_attr), GFP_KERNEL); - if (!soc_dev_attr) + if (!soc_dev_attr) { + of_node_put(backupram); return -ENOMEM; + } soc_info_populate(soc_dev_attr, backupram); + of_node_put(backupram); soc_dev = soc_device_register(soc_dev_attr); if (IS_ERR(soc_dev)) {