From patchwork Tue Mar 5 11:33:52 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Wen Yang X-Patchwork-Id: 10839337 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 055171575 for ; Tue, 5 Mar 2019 11:33:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E43252BE94 for ; Tue, 5 Mar 2019 11:33:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D4D882BED8; Tue, 5 Mar 2019 11:33:10 +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 691492BE94 for ; Tue, 5 Mar 2019 11:33:10 +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:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version: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:In-Reply-To:References: List-Owner; bh=1ssFiDSwXgOFWBS6q4ZKWTV+mL6NOBpiGFXJPm+hAXg=; b=FhGjE0MhRbs0jy 1Q3VHU+AEDk2G3wXJZSQIVcP/hyGKN4lzofpb07er6T1mO1qpVYy7NfePraSKr7K/jlPK1/VrXkHG ilGTpUrfMSYNMOKmMZ6rkM454jd4amoCUPGBR6rtUYl0E+wGVTqT1r2TRCWTDhIS4Rub7betH1gb4 +bvwVz6KU7wmFW66P/+4/Ggyji1C5KwTKMllUjBZRHQTBkn35qSB3SkRMJnfHIasBkzO6rwgEFVbr 52WkfHkBnBWlglmFWD3zSBCeZOQMMxHlwKafkR4Bc9wFnOxyqOhKDI0+TaPe2zO+jdKdRh8mRP6Vb /T8BkqDCqsFNJmv6fzcA==; 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 1h18Jl-0003KJ-AZ; Tue, 05 Mar 2019 11:33:05 +0000 Received: from out1.zte.com.cn ([202.103.147.172] helo=mxct.zte.com.cn) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1h18Jh-0003Io-F5 for linux-arm-kernel@lists.infradead.org; Tue, 05 Mar 2019 11:33:03 +0000 Received: from mse01.zte.com.cn (unknown [10.30.3.20]) by Forcepoint Email with ESMTPS id F407D36CDA6B083DE78B; Tue, 5 Mar 2019 19:32:59 +0800 (CST) Received: from notes_smtp.zte.com.cn ([10.30.1.239]) by mse01.zte.com.cn with ESMTP id x25BWpTd071851; Tue, 5 Mar 2019 19:32:51 +0800 (GMT-8) (envelope-from wen.yang99@zte.com.cn) Received: from fox-host8.localdomain ([10.74.120.8]) by szsmtp06.zte.com.cn (Lotus Domino Release 8.5.3FP6) with ESMTP id 2019030519330741-3291465 ; Tue, 5 Mar 2019 19:33:07 +0800 From: Wen Yang To: linux-kernel@vger.kernel.org Subject: [PATCH v2 01/15] ARM: actions: fix a leaked reference by adding missing of_node_put Date: Tue, 5 Mar 2019 19:33:52 +0800 Message-Id: <1551785646-46173-1-git-send-email-wen.yang99@zte.com.cn> X-Mailer: git-send-email 1.8.3.1 MIME-Version: 1.0 X-MIMETrack: Itemize by SMTP Server on SZSMTP06/server/zte_ltd(Release 8.5.3FP6|November 21, 2013) at 2019-03-05 19:33:07, Serialize by Router on notes_smtp/zte_ltd(Release 9.0.1FP7|August 17, 2016) at 2019-03-05 19:32:47 X-MAIL: mse01.zte.com.cn x25BWpTd071851 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190305_033301_670798_9779FFBC X-CRM114-Status: GOOD ( 11.41 ) 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: wang.yi59@zte.com.cn, Russell King , =?utf-8?q?An?= =?utf-8?q?dreas_F=C3=A4rber?= , Manivannan Sadhasivam , Wen Yang , linux-arm-kernel@lists.infradead.org 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 The call to of_get_next_child returns a node pointer with refcount incremented thus it must be explicitly decremented after the last usage. Detected by coccinelle with the following warnings: ./arch/arm/mach-actions/platsmp.c:112:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 103, but without a corresponding object release within this function. ./arch/arm/mach-actions/platsmp.c:124:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 115, but without a corresponding object release within this function. ./arch/arm/mach-actions/platsmp.c:137:3-9: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 128, but without a corresponding object release within this function. Signed-off-by: Wen Yang Reviewed-by: Florian Fainelli Cc: "Andreas Färber" Cc: Manivannan Sadhasivam Cc: Russell King Cc: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org --- v2->v1: add a missing space between "adding" and "missing" arch/arm/mach-actions/platsmp.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/arm/mach-actions/platsmp.c b/arch/arm/mach-actions/platsmp.c index 4fd479c..1a8e078 100644 --- a/arch/arm/mach-actions/platsmp.c +++ b/arch/arm/mach-actions/platsmp.c @@ -107,6 +107,7 @@ static void __init s500_smp_prepare_cpus(unsigned int max_cpus) } timer_base_addr = of_iomap(node, 0); + of_node_put(node); if (!timer_base_addr) { pr_err("%s: could not map timer registers\n", __func__); return; @@ -119,6 +120,7 @@ static void __init s500_smp_prepare_cpus(unsigned int max_cpus) } sps_base_addr = of_iomap(node, 0); + of_node_put(node); if (!sps_base_addr) { pr_err("%s: could not map sps registers\n", __func__); return; @@ -132,6 +134,7 @@ static void __init s500_smp_prepare_cpus(unsigned int max_cpus) } scu_base_addr = of_iomap(node, 0); + of_node_put(node); if (!scu_base_addr) { pr_err("%s: could not map scu registers\n", __func__); return; From patchwork Tue Mar 5 11:33:53 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wen Yang X-Patchwork-Id: 10839339 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 900841575 for ; Tue, 5 Mar 2019 11:33:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7A9662BE94 for ; Tue, 5 Mar 2019 11:33:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6F2662BED8; Tue, 5 Mar 2019 11:33: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 EE79C2BE94 for ; Tue, 5 Mar 2019 11:33:18 +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=/RVoQh3B326FJmNTsJvSVT6RsrbvQS4wYwZ4CPQqlfg=; b=IsPwKS0mYs0ud7z+M2C02OAL3e louosEqfF+m2zFHg9yBJOP7vDhYPwNeRjWeOW9scdQRtQAbOwthxZejq2xdFf9zUqEFsWHpzfO+FN au0cvadnqz11hGJx0tv0R163d7nTDKm01q61nzzg/PY5II86l8g76Ukv3IstPI1dO3SYHYAzLCzJi MfhuMtRwnzwDiYIdA0B2P45Hi7L9EbZAkOvLVyGAy6Q0kdKGvghSDPlAV8qir70C7/S3m45aF9m5L I7vU/ZOQLzWiiID1mfgyWVMiKGNO+VX+hrkzArzVZ/MugkCiiJldtiBn7j4VRBX9JwuJNcR9OJ9lR vwY+G4Fg==; 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 1h18Js-0003TU-S3; Tue, 05 Mar 2019 11:33:12 +0000 Received: from out1.zte.com.cn ([202.103.147.172] helo=mxct.zte.com.cn) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1h18Jh-0003Ip-Qu for linux-arm-kernel@lists.infradead.org; Tue, 05 Mar 2019 11:33:04 +0000 Received: from mse01.zte.com.cn (unknown [10.30.3.20]) by Forcepoint Email with ESMTPS id 45E66D6695AE9264076C; Tue, 5 Mar 2019 19:33:00 +0800 (CST) Received: from notes_smtp.zte.com.cn ([10.30.1.239]) by mse01.zte.com.cn with ESMTP id x25BWrsU071913; Tue, 5 Mar 2019 19:32:53 +0800 (GMT-8) (envelope-from wen.yang99@zte.com.cn) Received: from fox-host8.localdomain ([10.74.120.8]) by szsmtp06.zte.com.cn (Lotus Domino Release 8.5.3FP6) with ESMTP id 2019030519330991-3291500 ; Tue, 5 Mar 2019 19:33:09 +0800 From: Wen Yang To: linux-kernel@vger.kernel.org Subject: [PATCH v2 02/15] ARM: bcm: fix a leaked reference by adding missing of_node_put Date: Tue, 5 Mar 2019 19:33:53 +0800 Message-Id: <1551785646-46173-2-git-send-email-wen.yang99@zte.com.cn> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1551785646-46173-1-git-send-email-wen.yang99@zte.com.cn> References: <1551785646-46173-1-git-send-email-wen.yang99@zte.com.cn> X-MIMETrack: Itemize by SMTP Server on SZSMTP06/server/zte_ltd(Release 8.5.3FP6|November 21, 2013) at 2019-03-05 19:33:09, Serialize by Router on notes_smtp/zte_ltd(Release 9.0.1FP7|August 17, 2016) at 2019-03-05 19:32:49, Serialize complete at 2019-03-05 19:32:49 X-MAIL: mse01.zte.com.cn x25BWrsU071913 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190305_033302_034594_D4B35BDE X-CRM114-Status: GOOD ( 13.12 ) 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: wang.yi59@zte.com.cn, Florian Fainelli , Scott Branden , Ray Jui , Russell King , bcm-kernel-feedback-list@broadcom.com, Wen Yang , 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 The call to of_get_next_child returns a node pointer with refcount incremented thus it must be explicitly decremented after the last usage. Detected by coccinelle with the following warnings: ./arch/arm/mach-bcm/board_bcm281xx.c:43:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 35, but without a corresponding object release within this function. Signed-off-by: Wen Yang Reviewed-by: Florian Fainelli Cc: Florian Fainelli Cc: Ray Jui Cc: Scott Branden Cc: bcm-kernel-feedback-list@broadcom.com Cc: Russell King Cc: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org Acked-by: Ray Jui --- v2->v1: add a missing space between "adding" and "missing" arch/arm/mach-bcm/board_bcm281xx.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm/mach-bcm/board_bcm281xx.c b/arch/arm/mach-bcm/board_bcm281xx.c index b81bb38..1238ac8 100644 --- a/arch/arm/mach-bcm/board_bcm281xx.c +++ b/arch/arm/mach-bcm/board_bcm281xx.c @@ -38,6 +38,7 @@ static void bcm281xx_restart(enum reboot_mode mode, const char *cmd) return; } base = of_iomap(np_wdog, 0); + of_node_put(np_wdog); if (!base) { pr_emerg("Couldn't map brcm,kona-wdt\n"); return; From patchwork Tue Mar 5 11:33:54 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wen Yang X-Patchwork-Id: 10839341 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 F4009139A for ; Tue, 5 Mar 2019 11:33:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DD33D2BE94 for ; Tue, 5 Mar 2019 11:33:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CFD742BED8; Tue, 5 Mar 2019 11:33:27 +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 3F54C2BE94 for ; Tue, 5 Mar 2019 11:33:27 +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=eIWT0jlPT2e+cuPn5SUgpMf/EocN//KEMWhwpVfWa2A=; b=k0K98mVe394X1z9oKb03azzE9U hyBFTj/oRGZvpusyuC2p5WPiLYROBMhQtUHCZieulZd7kAnI5D9zO6Rsp902A5rqlyjgLUrarbQay IbBTwVyZROLIScx9BWAxDfBdLtPXRmYRuXji7NfokOkPMqlJHqel2TwslicpcfUgqKAGRfLACkzCi AWStw/5iw14cXGmiFqvEf/dobWF/UhwJQenS63r83No84lFZwK+sHQXXnrsJKq9iM2tesCG2/nFxA tBnjQMs4tJK1WFEB9hIKsejHX7KbgTyXj9hivlyYMYd9EQZm078lxj2mBPk+BV1DI/AcCurhM91iB 8KxlKHYg==; 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 1h18K5-0003lC-73; Tue, 05 Mar 2019 11:33:25 +0000 Received: from mxhk.zte.com.cn ([63.217.80.70]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1h18Jj-0003JY-43 for linux-arm-kernel@lists.infradead.org; Tue, 05 Mar 2019 11:33:04 +0000 Received: from mse01.zte.com.cn (unknown [10.30.3.20]) by Forcepoint Email with ESMTPS id A619ADF94734B0412347; Tue, 5 Mar 2019 19:33:01 +0800 (CST) Received: from notes_smtp.zte.com.cn ([10.30.1.239]) by mse01.zte.com.cn with ESMTP id x25BWuc1072299; Tue, 5 Mar 2019 19:32:56 +0800 (GMT-8) (envelope-from wen.yang99@zte.com.cn) Received: from fox-host8.localdomain ([10.74.120.8]) by szsmtp06.zte.com.cn (Lotus Domino Release 8.5.3FP6) with ESMTP id 2019030519331226-3291527 ; Tue, 5 Mar 2019 19:33:12 +0800 From: Wen Yang To: linux-kernel@vger.kernel.org Subject: [PATCH v2 03/15] ARM: exynos: fix a leaked reference by adding missing of_node_put Date: Tue, 5 Mar 2019 19:33:54 +0800 Message-Id: <1551785646-46173-3-git-send-email-wen.yang99@zte.com.cn> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1551785646-46173-1-git-send-email-wen.yang99@zte.com.cn> References: <1551785646-46173-1-git-send-email-wen.yang99@zte.com.cn> X-MIMETrack: Itemize by SMTP Server on SZSMTP06/server/zte_ltd(Release 8.5.3FP6|November 21, 2013) at 2019-03-05 19:33:12, Serialize by Router on notes_smtp/zte_ltd(Release 9.0.1FP7|August 17, 2016) at 2019-03-05 19:32:52, Serialize complete at 2019-03-05 19:32:52 X-MAIL: mse01.zte.com.cn x25BWuc1072299 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190305_033303_336363_32835407 X-CRM114-Status: GOOD ( 12.82 ) 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: wang.yi59@zte.com.cn, linux-samsung-soc@vger.kernel.org, Russell King , Krzysztof Kozlowski , Kukjin Kim , Wen Yang , 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 The call to of_get_next_child returns a node pointer with refcount incremented thus it must be explicitly decremented after the last usage. Detected by coccinelle with the following warnings: ./arch/arm/mach-exynos/firmware.c:201:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 193, but without a corresponding object release within this function. ./arch/arm/mach-exynos/firmware.c:204:1-7: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 193, but without a corresponding object release within this function. ./arch/arm/mach-exynos/suspend.c:642:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 634, but without a corresponding object release within this function. Signed-off-by: Wen Yang Reviewed-by: Florian Fainelli Cc: Russell King Cc: Kukjin Kim Cc: Krzysztof Kozlowski Cc: linux-arm-kernel@lists.infradead.org Cc: linux-samsung-soc@vger.kernel.org Cc: linux-kernel@vger.kernel.org --- v2->v1: add a missing space between "adding" and "missing" arch/arm/mach-exynos/firmware.c | 1 + arch/arm/mach-exynos/suspend.c | 2 ++ 2 files changed, 3 insertions(+) diff --git a/arch/arm/mach-exynos/firmware.c b/arch/arm/mach-exynos/firmware.c index d602e3b..2eaf2db 100644 --- a/arch/arm/mach-exynos/firmware.c +++ b/arch/arm/mach-exynos/firmware.c @@ -196,6 +196,7 @@ bool __init exynos_secure_firmware_available(void) return false; addr = of_get_address(nd, 0, NULL, NULL); + of_node_put(nd); if (!addr) { pr_err("%s: No address specified.\n", __func__); return false; diff --git a/arch/arm/mach-exynos/suspend.c b/arch/arm/mach-exynos/suspend.c index 0850505..9afb0c6 100644 --- a/arch/arm/mach-exynos/suspend.c +++ b/arch/arm/mach-exynos/suspend.c @@ -639,8 +639,10 @@ void __init exynos_pm_init(void) if (WARN_ON(!of_find_property(np, "interrupt-controller", NULL))) { pr_warn("Outdated DT detected, suspend/resume will NOT work\n"); + of_node_put(np); return; } + of_node_put(np); pm_data = (const struct exynos_pm_data *) match->data; From patchwork Tue Mar 5 11:33:55 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wen Yang X-Patchwork-Id: 10839343 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 85E80139A for ; Tue, 5 Mar 2019 11:33:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6CD342BE94 for ; Tue, 5 Mar 2019 11:33:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5DC1D2BED8; Tue, 5 Mar 2019 11:33:42 +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 B4C1E2BE94 for ; Tue, 5 Mar 2019 11:33:41 +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=38Ub6rm8+fp7UI2IS2wJIG5KqHLd9mHX7St9TeSTDnA=; b=FdOaw2mFT+5MHk3S0QWAHrm2+U JIu9GTPTf+JecjkASoPSw0dqqaUbrb7E1Cdjl13k4dkSRoPUCN72CDl8XeeQNfHl4HEGQxuGT/fWA 5yvHTVVpCnKV9TBYaL0lvTnhF8y8jW4vkvcpoAw8NvtnsjZfAn6RMHaVD9sZQum/rfL8GIfA7TLuj GWj910HgPBuqduH2m6wk8a4oTIgn1vSJbaVzrSgCIx8MQnkD2exLAtVv/kDCLa+NOeFGwiqo7Gf5h atKRrp6Gj3zzZyg8zF5LEYuMuGxeaR7n02W/A0bTmi02r9m7Z7/hlKRQCsBvBuuYpgPf+v0kn8Jnf HX5Dd0Gw==; 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 1h18KG-000411-32; Tue, 05 Mar 2019 11:33:36 +0000 Received: from out1.zte.com.cn ([202.103.147.172] helo=mxct.zte.com.cn) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1h18Jk-0003Je-Di for linux-arm-kernel@lists.infradead.org; Tue, 05 Mar 2019 11:33:07 +0000 Received: from mse01.zte.com.cn (unknown [10.30.3.20]) by Forcepoint Email with ESMTPS id 6181D86964BA3369A5EA; Tue, 5 Mar 2019 19:33:02 +0800 (CST) Received: from notes_smtp.zte.com.cn ([10.30.1.239]) by mse01.zte.com.cn with ESMTP id x25BWv81072314; Tue, 5 Mar 2019 19:32:57 +0800 (GMT-8) (envelope-from wen.yang99@zte.com.cn) Received: from fox-host8.localdomain ([10.74.120.8]) by szsmtp06.zte.com.cn (Lotus Domino Release 8.5.3FP6) with ESMTP id 2019030519331333-3291555 ; Tue, 5 Mar 2019 19:33:13 +0800 From: Wen Yang To: linux-kernel@vger.kernel.org Subject: [PATCH v2 04/15] ARM: hisi: fix a leaked reference by adding missing of_node_put Date: Tue, 5 Mar 2019 19:33:55 +0800 Message-Id: <1551785646-46173-4-git-send-email-wen.yang99@zte.com.cn> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1551785646-46173-1-git-send-email-wen.yang99@zte.com.cn> References: <1551785646-46173-1-git-send-email-wen.yang99@zte.com.cn> X-MIMETrack: Itemize by SMTP Server on SZSMTP06/server/zte_ltd(Release 8.5.3FP6|November 21, 2013) at 2019-03-05 19:33:13, Serialize by Router on notes_smtp/zte_ltd(Release 9.0.1FP7|August 17, 2016) at 2019-03-05 19:32:53, Serialize complete at 2019-03-05 19:32:53 X-MAIL: mse01.zte.com.cn x25BWv81072314 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190305_033305_050856_568A42BE X-CRM114-Status: GOOD ( 15.02 ) 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: wang.yi59@zte.com.cn, linux-arm-kernel@lists.infradead.org, Wen Yang , Wei Xu , Russell King 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 The call to of_get_next_child returns a node pointer with refcount incremented thus it must be explicitly decremented after the last usage. Detected by coccinelle with the following warnings: ./arch/arm/mach-hisi/platsmp.c:74:3-9: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 66, but without a corresponding object release within this function. ./arch/arm/mach-hisi/platsmp.c:78:3-9: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 66, but without a corresponding object release within this function. ./arch/arm/mach-hisi/platmcpm.c:337:1-7: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 275, but without a corresponding object release within this function. ./arch/arm/mach-hisi/platmcpm.c:347:1-7: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 275, but without a corresponding object release within this function. ./arch/arm/mach-hisi/platmcpm.c:337:1-7: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 284, but without a corresponding object release within this function. ./arch/arm/mach-hisi/platmcpm.c:347:1-7: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 284, but without a corresponding object release within this function. ./arch/arm/mach-hisi/platmcpm.c:337:1-7: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 287, but without a corresponding object release within this function. ./arch/arm/mach-hisi/platmcpm.c:347:1-7: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 287, but without a corresponding object release within this function. Signed-off-by: Wen Yang Reviewed-by: Florian Fainelli Cc: Wei Xu Cc: Russell King Cc: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org --- v2->v1: add a missing space between "adding" and "missing" arch/arm/mach-hisi/platmcpm.c | 12 ++++++++++-- arch/arm/mach-hisi/platsmp.c | 7 +++++-- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/arch/arm/mach-hisi/platmcpm.c b/arch/arm/mach-hisi/platmcpm.c index f66815c..695423c 100644 --- a/arch/arm/mach-hisi/platmcpm.c +++ b/arch/arm/mach-hisi/platmcpm.c @@ -277,6 +277,7 @@ static int __init hip04_smp_init(void) goto err; ret = of_property_read_u32_array(np, "boot-method", &hip04_boot_method[0], 4); + of_node_put(np); if (ret) goto err; @@ -285,12 +286,14 @@ static int __init hip04_smp_init(void) if (!np_sctl) goto err; np_fab = of_find_compatible_node(NULL, NULL, "hisilicon,hip04-fabric"); - if (!np_fab) + if (!np_fab) { + of_node_put(np_sctl); goto err; + } ret = memblock_reserve(hip04_boot_method[0], hip04_boot_method[1]); if (ret) - goto err; + goto err_put_node; relocation = ioremap(hip04_boot_method[2], hip04_boot_method[3]); if (!relocation) { @@ -334,6 +337,8 @@ static int __init hip04_smp_init(void) iounmap(relocation); smp_set_ops(&hip04_smp_ops); + of_node_put(np_fab); + of_node_put(np_sctl); return ret; err_table: iounmap(fabric); @@ -343,6 +348,9 @@ static int __init hip04_smp_init(void) iounmap(relocation); err_reloc: memblock_free(hip04_boot_method[0], hip04_boot_method[1]); +err_put_node: + of_node_put(np_fab); + of_node_put(np_sctl); err: return ret; } diff --git a/arch/arm/mach-hisi/platsmp.c b/arch/arm/mach-hisi/platsmp.c index da5689a..ecc68fa 100644 --- a/arch/arm/mach-hisi/platsmp.c +++ b/arch/arm/mach-hisi/platsmp.c @@ -71,14 +71,17 @@ static void __init hi3xxx_smp_prepare_cpus(unsigned int max_cpus) ctrl_base = of_iomap(np, 0); if (!ctrl_base) { pr_err("failed to map address\n"); - return; + goto out_put_node; } if (of_property_read_u32(np, "smp-offset", &offset) < 0) { pr_err("failed to find smp-offset property\n"); - return; + goto out_put_node; } ctrl_base += offset; } + +out_put_node: + of_node_put(np); } static int hi3xxx_boot_secondary(unsigned int cpu, struct task_struct *idle) From patchwork Tue Mar 5 11:33:56 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wen Yang X-Patchwork-Id: 10839345 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 1CF38139A for ; Tue, 5 Mar 2019 11:33:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 08F982BE94 for ; Tue, 5 Mar 2019 11:33:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F1BB02BED8; Tue, 5 Mar 2019 11:33:52 +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 989732BE94 for ; Tue, 5 Mar 2019 11:33:52 +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=9V3KOaz1TecIC7PgESc+dLucP3r0tRzZE84WD3O6rio=; b=NgA6FI7SBOo63mqxcis74AwBIF 3X+bsRH+XkgEDq0jvLQQ4zdHTrNOetrUMN+CdVY0dNtml9r/DaqUwkVNPVKFVTsTOI1jG2Ty4YtjH e5iZHxI72qGd65FvS2VOP1g6puPGprOoAB0ApKFHQH+1sL01XNVPmKtPmAHluOsDc5gd0/j2nOa5K xf+AgLBst8ROX6chhWnE5pMDOrXm6EjegKy8qbenz7bjIAcBe8sVtPgrqq1+P7sYsgkaRHnqyvTrG DY8j/gYjfsLpDPS7LtG2RcZ8cDSEDh3lQ7bCH/EkyIvDNWVZfSa11EUgVp3Xt0nag4w5v+bHLP+wj FACrYIMw==; 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 1h18KQ-0004F2-UY; Tue, 05 Mar 2019 11:33:46 +0000 Received: from out1.zte.com.cn ([202.103.147.172] helo=mxct.zte.com.cn) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1h18Jm-0003Kk-LN for linux-arm-kernel@lists.infradead.org; Tue, 05 Mar 2019 11:33:10 +0000 Received: from mse01.zte.com.cn (unknown [10.30.3.20]) by Forcepoint Email with ESMTPS id 4AD5CB2419035C0E3F6A; Tue, 5 Mar 2019 19:33:05 +0800 (CST) Received: from notes_smtp.zte.com.cn ([10.30.1.239]) by mse01.zte.com.cn with ESMTP id x25BWw5P072352; Tue, 5 Mar 2019 19:32:58 +0800 (GMT-8) (envelope-from wen.yang99@zte.com.cn) Received: from fox-host8.localdomain ([10.74.120.8]) by szsmtp06.zte.com.cn (Lotus Domino Release 8.5.3FP6) with ESMTP id 2019030519331458-3291569 ; Tue, 5 Mar 2019 19:33:14 +0800 From: Wen Yang To: linux-kernel@vger.kernel.org Subject: [PATCH v2 05/15] ARM: imx51: fix a leaked reference by adding missing of_node_put Date: Tue, 5 Mar 2019 19:33:56 +0800 Message-Id: <1551785646-46173-5-git-send-email-wen.yang99@zte.com.cn> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1551785646-46173-1-git-send-email-wen.yang99@zte.com.cn> References: <1551785646-46173-1-git-send-email-wen.yang99@zte.com.cn> X-MIMETrack: Itemize by SMTP Server on SZSMTP06/server/zte_ltd(Release 8.5.3FP6|November 21, 2013) at 2019-03-05 19:33:14, Serialize by Router on notes_smtp/zte_ltd(Release 9.0.1FP7|August 17, 2016) at 2019-03-05 19:32:54, Serialize complete at 2019-03-05 19:32:54 X-MAIL: mse01.zte.com.cn x25BWw5P072352 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190305_033307_109777_EBB8FDAF X-CRM114-Status: GOOD ( 12.30 ) 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: wang.yi59@zte.com.cn, Fabio Estevam , Sascha Hauer , Russell King , NXP Linux Team , Pengutronix Kernel Team , Shawn Guo , Wen Yang , linux-arm-kernel@lists.infradead.org, Lucas Stach 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 The call to of_get_next_child returns a node pointer with refcount incremented thus it must be explicitly decremented after the last usage. Detected by coccinelle with the following warnings: ./arch/arm/mach-imx/mach-imx51.c:64:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 57, but without a corresponding object release within this function. Signed-off-by: Wen Yang Reviewed-by: Florian Fainelli Cc: Russell King Cc: Shawn Guo Cc: Sascha Hauer Cc: Pengutronix Kernel Team Cc: Fabio Estevam Cc: NXP Linux Team Cc: Lucas Stach Cc: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org --- v2->v1: add a missing space between "adding" and "missing" arch/arm/mach-imx/mach-imx51.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm/mach-imx/mach-imx51.c b/arch/arm/mach-imx/mach-imx51.c index c7169c2..08c7892 100644 --- a/arch/arm/mach-imx/mach-imx51.c +++ b/arch/arm/mach-imx/mach-imx51.c @@ -59,6 +59,7 @@ static void __init imx51_m4if_setup(void) return; m4if_base = of_iomap(np, 0); + of_node_put(np); if (!m4if_base) { pr_err("Unable to map M4IF registers\n"); return; From patchwork Tue Mar 5 11:33:57 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wen Yang X-Patchwork-Id: 10839349 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 7B7111575 for ; Tue, 5 Mar 2019 11:34:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 62A74286A7 for ; Tue, 5 Mar 2019 11:34:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 557322835B; Tue, 5 Mar 2019 11:34:06 +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 558C22835B for ; Tue, 5 Mar 2019 11:34:04 +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=ccX6aTsKf57Wt8avmZ7R6FxO4UnlcuXjjtyds9fuhUA=; b=d2w5AwEbKWYieWwHeJKjP51qLP nbidvRrcNrXhbC626uCOI7SmsXZmFvy0MEpcIfMKwMXwGHHS4u8/Y6kRrlCFVHZptwYodURMX2BiO Dhdg38I8Oz0urK+Xmy8CU8WFcEH4vN0filO2bxUs33/2MzM2yLhppMZ/n6v/MfvD2kvAUUrZUOpZ8 j78WeibwCIHBXMauomFNA0t7WKsRMmzRIwXDl0d2YW5RSDYQNCArT0q0sCtgKPKjvlT4NV0W9XJvx X/YKEh0R1GF4BcTwo+O7L9nqV4nC0sRtr90IHQ0Mn6RpL5W0KdzGbKcQPkqsEnvB80jpNw/D6XCgw Q5b0m1wA==; 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 1h18Kc-0004UG-1I; Tue, 05 Mar 2019 11:33:58 +0000 Received: from out1.zte.com.cn ([202.103.147.172] helo=mxct.zte.com.cn) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1h18Jo-0003Mf-6H for linux-arm-kernel@lists.infradead.org; Tue, 05 Mar 2019 11:33:12 +0000 Received: from mse01.zte.com.cn (unknown [10.30.3.20]) by Forcepoint Email with ESMTPS id CC10D6ABC5F0470C03B2; Tue, 5 Mar 2019 19:33:06 +0800 (CST) Received: from notes_smtp.zte.com.cn ([10.30.1.239]) by mse01.zte.com.cn with ESMTP id x25BWxCx072382; Tue, 5 Mar 2019 19:32:59 +0800 (GMT-8) (envelope-from wen.yang99@zte.com.cn) Received: from fox-host8.localdomain ([10.74.120.8]) by szsmtp06.zte.com.cn (Lotus Domino Release 8.5.3FP6) with ESMTP id 2019030519331580-3291579 ; Tue, 5 Mar 2019 19:33:15 +0800 From: Wen Yang To: linux-kernel@vger.kernel.org Subject: [PATCH v2 06/15] arm: npcm: fix a leaked reference by adding missing of_node_put Date: Tue, 5 Mar 2019 19:33:57 +0800 Message-Id: <1551785646-46173-6-git-send-email-wen.yang99@zte.com.cn> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1551785646-46173-1-git-send-email-wen.yang99@zte.com.cn> References: <1551785646-46173-1-git-send-email-wen.yang99@zte.com.cn> X-MIMETrack: Itemize by SMTP Server on SZSMTP06/server/zte_ltd(Release 8.5.3FP6|November 21, 2013) at 2019-03-05 19:33:15, Serialize by Router on notes_smtp/zte_ltd(Release 9.0.1FP7|August 17, 2016) at 2019-03-05 19:32:55, Serialize complete at 2019-03-05 19:32:55 X-MAIL: mse01.zte.com.cn x25BWxCx072382 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190305_033308_875832_DE922287 X-CRM114-Status: GOOD ( 11.43 ) 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: wang.yi59@zte.com.cn, Tomer Maimon , Avi Fishman , Patrick Venture , openbmc@lists.ozlabs.org, Brendan Higgins , Russell King , Nancy Yuen , Wen Yang , 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 The call to of_get_next_child returns a node pointer with refcount incremented thus it must be explicitly decremented after the last usage. Detected by coccinelle with the following warnings: ./arch/arm/mach-npcm/platsmp.c:52:1-7: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 31, but without a corresponding object release within this function. ./arch/arm/mach-npcm/platsmp.c:68:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 60, but without a corresponding object release within this function. Signed-off-by: Wen Yang Reviewed-by: Florian Fainelli Cc: Avi Fishman Cc: Tomer Maimon Cc: Patrick Venture Cc: Nancy Yuen Cc: Brendan Higgins Cc: Russell King Cc: linux-arm-kernel@lists.infradead.org Cc: openbmc@lists.ozlabs.org Cc: linux-kernel@vger.kernel.org Reviewed-by: Avi Fishman --- v2->v1: add a missing space between "adding" and "missing" arch/arm/mach-npcm/platsmp.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/arm/mach-npcm/platsmp.c b/arch/arm/mach-npcm/platsmp.c index 21633c7..fe63edc 100644 --- a/arch/arm/mach-npcm/platsmp.c +++ b/arch/arm/mach-npcm/platsmp.c @@ -35,6 +35,7 @@ static int npcm7xx_smp_boot_secondary(unsigned int cpu, goto out; } gcr_base = of_iomap(gcr_np, 0); + of_node_put(gcr_np); if (!gcr_base) { pr_err("could not iomap gcr"); ret = -ENOMEM; @@ -63,6 +64,7 @@ static void __init npcm7xx_smp_prepare_cpus(unsigned int max_cpus) return; } scu_base = of_iomap(scu_np, 0); + of_node_put(scu_np); if (!scu_base) { pr_err("could not iomap scu"); return; From patchwork Tue Mar 5 11:33:58 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wen Yang X-Patchwork-Id: 10839351 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 867D6139A for ; Tue, 5 Mar 2019 11:34:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6EDE22835B for ; Tue, 5 Mar 2019 11:34:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 62A19286B5; Tue, 5 Mar 2019 11:34:12 +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 C25E12835B for ; Tue, 5 Mar 2019 11:34:11 +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=/nrarERtcFgqDqjJzCrV0WVtgPpnTptxANuLecFfO7Q=; b=otPMlPxiSQIHT/S6GgkJz5f9cX ON8EvNSaEkv8Y55a5VE0Z+zV5gVEtURi1mXxu7R5hFQDQBz/m+/B896lyh4/f7ypsA0Jo4T9u5S5e PXjAcgDyxVW4/WrGta599ITq/MN7sli2nlZEIVZbLqPG1ntlhGBl247h/WFju0fHNoEERMQGtUVMD gtTZogZhKzgpHDlW9Z3nz2dMabcaPRpKMKPxwl9n99KTDQ3VA6Yv8rzQj2V9yB6JUANwwF+s3rFOZ 9KOMVDGrotn3UN9MtCDiORV2q4hRx2+ApLgH70FJA9Mo3ncc2COeEby4xOtih5MeQjkcZElrWbhQJ gX2GZ/eQ==; 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 1h18Kn-0004j6-0q; Tue, 05 Mar 2019 11:34:09 +0000 Received: from mxhk.zte.com.cn ([63.217.80.70]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1h18Jq-0003QU-Pi; Tue, 05 Mar 2019 11:33:18 +0000 Received: from mse01.zte.com.cn (unknown [10.30.3.20]) by Forcepoint Email with ESMTPS id 76F8475175523C59F9C0; Tue, 5 Mar 2019 19:33:09 +0800 (CST) Received: from notes_smtp.zte.com.cn ([10.30.1.239]) by mse01.zte.com.cn with ESMTP id x25BX09R072427; Tue, 5 Mar 2019 19:33:01 +0800 (GMT-8) (envelope-from wen.yang99@zte.com.cn) Received: from fox-host8.localdomain ([10.74.120.8]) by szsmtp06.zte.com.cn (Lotus Domino Release 8.5.3FP6) with ESMTP id 2019030519331688-3291588 ; Tue, 5 Mar 2019 19:33:16 +0800 From: Wen Yang To: linux-kernel@vger.kernel.org Subject: [PATCH v2 07/15] ARM: rockchip: fix a leaked reference by adding missing of_node_put Date: Tue, 5 Mar 2019 19:33:58 +0800 Message-Id: <1551785646-46173-7-git-send-email-wen.yang99@zte.com.cn> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1551785646-46173-1-git-send-email-wen.yang99@zte.com.cn> References: <1551785646-46173-1-git-send-email-wen.yang99@zte.com.cn> X-MIMETrack: Itemize by SMTP Server on SZSMTP06/server/zte_ltd(Release 8.5.3FP6|November 21, 2013) at 2019-03-05 19:33:16, Serialize by Router on notes_smtp/zte_ltd(Release 9.0.1FP7|August 17, 2016) at 2019-03-05 19:32:57, Serialize complete at 2019-03-05 19:32:57 X-MAIL: mse01.zte.com.cn x25BX09R072427 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190305_033311_619642_04D41937 X-CRM114-Status: GOOD ( 16.31 ) 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: wang.yi59@zte.com.cn, Heiko Stuebner , Russell King , linux-rockchip@lists.infradead.org, Wen Yang , 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 The call to of_get_next_child returns a node pointer with refcount incremented thus it must be explicitly decremented after the last usage. Detected by coccinelle with the following warnings: ./arch/arm/mach-rockchip/pm.c:269:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 259, but without a corresponding object release within this function. ./arch/arm/mach-rockchip/pm.c:275:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 259, but without a corresponding object release within this function ./arch/arm/mach-rockchip/platsmp.c:280:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 271, but without a corresponding object release within this function. ./arch/arm/mach-rockchip/platsmp.c:284:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 271, but without a corresponding object release within this function. ./arch/arm/mach-rockchip/platsmp.c:288:3-9: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 271, but without a corresponding object release within this function. ./arch/arm/mach-rockchip/platsmp.c:302:3-9: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 293, but without a corresponding object release within this function. ./arch/arm/mach-rockchip/platsmp.c:250:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 241, but without a corresponding object release within this function. ./arch/arm/mach-rockchip/platsmp.c:260:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 241, but without a corresponding object release within this function. ./arch/arm/mach-rockchip/platsmp.c:263:1-7: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 241, but without a corresponding object release within this function. Signed-off-by: Wen Yang Reviewed-by: Florian Fainelli Cc: Russell King Cc: Heiko Stuebner Cc: linux-arm-kernel@lists.infradead.org Cc: linux-rockchip@lists.infradead.org Cc: linux-kernel@vger.kernel.org --- v2->v1: add a missing space between "adding" and "missing" arch/arm/mach-rockchip/platsmp.c | 12 ++++++++---- arch/arm/mach-rockchip/pm.c | 11 ++++++----- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/arch/arm/mach-rockchip/platsmp.c b/arch/arm/mach-rockchip/platsmp.c index 51984a4..f93d64e 100644 --- a/arch/arm/mach-rockchip/platsmp.c +++ b/arch/arm/mach-rockchip/platsmp.c @@ -277,19 +277,20 @@ static void __init rockchip_smp_prepare_cpus(unsigned int max_cpus) sram_base_addr = of_iomap(node, 0); if (!sram_base_addr) { pr_err("%s: could not map sram registers\n", __func__); - return; + goto out_put_node; } if (has_pmu && rockchip_smp_prepare_pmu()) - return; + goto out_put_node; if (read_cpuid_part() == ARM_CPU_PART_CORTEX_A9) { if (rockchip_smp_prepare_sram(node)) - return; + goto out_put_node; /* enable the SCU power domain */ pmu_set_power_domain(PMU_PWRDN_SCU, true); + of_node_put(node); node = of_find_compatible_node(NULL, NULL, "arm,cortex-a9-scu"); if (!node) { pr_err("%s: missing scu\n", __func__); @@ -299,7 +300,7 @@ static void __init rockchip_smp_prepare_cpus(unsigned int max_cpus) scu_base_addr = of_iomap(node, 0); if (!scu_base_addr) { pr_err("%s: could not map scu registers\n", __func__); - return; + goto out_put_node; } /* @@ -321,6 +322,9 @@ static void __init rockchip_smp_prepare_cpus(unsigned int max_cpus) /* Make sure that all cores except the first are really off */ for (i = 1; i < ncores; i++) pmu_set_power_domain(0 + i, false); + +out_put_node: + of_node_put(node); } static void __init rk3036_smp_prepare_cpus(unsigned int max_cpus) diff --git a/arch/arm/mach-rockchip/pm.c b/arch/arm/mach-rockchip/pm.c index 0592534..43a16c9 100644 --- a/arch/arm/mach-rockchip/pm.c +++ b/arch/arm/mach-rockchip/pm.c @@ -266,25 +266,26 @@ static int rk3288_suspend_init(struct device_node *np) rk3288_bootram_base = of_iomap(sram_np, 0); if (!rk3288_bootram_base) { pr_err("%s: could not map bootram base\n", __func__); - return -ENOMEM; + ret = -ENOMEM; + goto out_put_node; } ret = of_address_to_resource(sram_np, 0, &res); if (ret) { pr_err("%s: could not get bootram phy addr\n", __func__); - return ret; + goto out_put_node; } rk3288_bootram_phy = res.start; - of_node_put(sram_np); - rk3288_config_bootdata(); /* copy resume code and data to bootsram */ memcpy(rk3288_bootram_base, rockchip_slp_cpu_resume, rk3288_bootram_sz); - return 0; +out_put_node: + of_node_put(sram_np); + return ret; } static const struct platform_suspend_ops rk3288_suspend_ops = { From patchwork Tue Mar 5 11:33:59 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wen Yang X-Patchwork-Id: 10839355 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 386531390 for ; Tue, 5 Mar 2019 11:34:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 234712BED8 for ; Tue, 5 Mar 2019 11:34:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1739B2BEE3; Tue, 5 Mar 2019 11:34:27 +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 B11352BED8 for ; Tue, 5 Mar 2019 11:34:26 +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=gUZPjB6gMZmwqCONGPNNGmD1siPWu78ovK31+zjZdk8=; b=To7xFawJjqRCoUAIXVAgehW31q l+/aSX/O7ljE7pK6VbOawrC1V9IZ9JklBWkgC3zlUvd8e+i2LTKmgKzlyRMAPfDQZxU3PIrS+M8fL sy2xRuxDnTGDHIlyg9JG1c1O2HBw9gtdbikpUwCcbixxtFkPBDfRnze8VRsU6ebOhNv+0Wu+vx7aa QRaPeB/GiFfdWsrgKCrRUX0UTEB8sKJ1ZMcF0ZbnH/7/3jITnaY082XPsul+3ZhgRQj9oxYh1vGHB T+z3rvzOB7S1/OOKBMnPbAczNk9M39lp7YvxNONMMDSoJjV+GKEx7qwKcWkOy17BcJ+YsUaXx7ZXX KArjmHxg==; 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 1h18Kx-0004x8-Vo; Tue, 05 Mar 2019 11:34:19 +0000 Received: from out1.zte.com.cn ([202.103.147.172] helo=mxct.zte.com.cn) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1h18Jr-0003Rg-UQ for linux-arm-kernel@lists.infradead.org; Tue, 05 Mar 2019 11:33:19 +0000 Received: from mse01.zte.com.cn (unknown [10.30.3.20]) by Forcepoint Email with ESMTPS id 2C015217BFE4A0B764F7; Tue, 5 Mar 2019 19:33:10 +0800 (CST) Received: from notes_smtp.zte.com.cn ([10.30.1.239]) by mse01.zte.com.cn with ESMTP id x25BX2j8072428; Tue, 5 Mar 2019 19:33:02 +0800 (GMT-8) (envelope-from wen.yang99@zte.com.cn) Received: from fox-host8.localdomain ([10.74.120.8]) by szsmtp06.zte.com.cn (Lotus Domino Release 8.5.3FP6) with ESMTP id 2019030519331802-3291598 ; Tue, 5 Mar 2019 19:33:18 +0800 From: Wen Yang To: linux-kernel@vger.kernel.org Subject: [PATCH v2 08/15] ARM: shmobile: fix a leaked reference by adding missing of_node_put Date: Tue, 5 Mar 2019 19:33:59 +0800 Message-Id: <1551785646-46173-8-git-send-email-wen.yang99@zte.com.cn> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1551785646-46173-1-git-send-email-wen.yang99@zte.com.cn> References: <1551785646-46173-1-git-send-email-wen.yang99@zte.com.cn> X-MIMETrack: Itemize by SMTP Server on SZSMTP06/server/zte_ltd(Release 8.5.3FP6|November 21, 2013) at 2019-03-05 19:33:18, Serialize by Router on notes_smtp/zte_ltd(Release 9.0.1FP7|August 17, 2016) at 2019-03-05 19:32:58, Serialize complete at 2019-03-05 19:32:58 X-MAIL: mse01.zte.com.cn x25BX2j8072428 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190305_033312_584165_408FA164 X-CRM114-Status: GOOD ( 12.57 ) 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: wang.yi59@zte.com.cn, Magnus Damm , Russell King , linux-renesas-soc@vger.kernel.org, Simon Horman , Wen Yang , 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 The call to of_get_next_child returns a node pointer with refcount incremented thus it must be explicitly decremented after the last usage. Detected by coccinelle with the following warnings: ./arch/arm/mach-shmobile/pm-rcar-gen2.c:77:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 66, but without a corresponding object release within this function. ./arch/arm/mach-shmobile/pm-rcar-gen2.c:85:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 66, but without a corresponding object release within this function. ./arch/arm/mach-shmobile/pm-rcar-gen2.c:90:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 66, but without a corresponding object release within this function. Signed-off-by: Wen Yang Reviewed-by: Florian Fainelli Reviewed-by: Geert Uytterhoeven Cc: Simon Horman Cc: Magnus Damm Cc: Russell King Cc: linux-renesas-soc@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org --- v2->v1: add a missing space between "adding" and "missing" arch/arm/mach-shmobile/pm-rcar-gen2.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm/mach-shmobile/pm-rcar-gen2.c b/arch/arm/mach-shmobile/pm-rcar-gen2.c index 8c2a205..e84599d 100644 --- a/arch/arm/mach-shmobile/pm-rcar-gen2.c +++ b/arch/arm/mach-shmobile/pm-rcar-gen2.c @@ -72,6 +72,7 @@ void __init rcar_gen2_pm_init(void) } error = of_address_to_resource(np, 0, &res); + of_node_put(np); if (error) { pr_err("Failed to get smp-sram address: %d\n", error); return; From patchwork Tue Mar 5 11:34:00 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wen Yang X-Patchwork-Id: 10839357 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 759BE1390 for ; Tue, 5 Mar 2019 11:34:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5B5A52BED8 for ; Tue, 5 Mar 2019 11:34:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4EE272BEE3; Tue, 5 Mar 2019 11:34:43 +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 EDE1A2BED8 for ; Tue, 5 Mar 2019 11:34:35 +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=BjnkLX+Aky8+LpUcqlaqQWC3Kd59FitNgkziosvqUnQ=; b=NQgb2VkFTNTEF4Mbh45YSbiubO CiwmKN6kTuBETk9OliaJbhQHTx5vHzrB1c5c4W6ortbonVY1+8TMtlHVjpvIQzHEv6DQB1sg3jsbW l39sl76fz60Hzbw/ZWivN4iFPBkN17FO5otrNJl/fFdfSZVy8kYQIu+AbShzsKPEtIkHM9rObTRCI FeqVyMTqmWSGCUcfytDaLmGsFx1Cx980TU+GWRqq5R13MGeR1lUdxJRXjS0CdYPgRvCL3K+3wPxEn sr+vNmsHrZWxucwKlG3ZbNhhASgHTpXu1WEA/0n4fO4qSbh3brLacu4Us8S1Gh4lrGSfmoTEFdaCC 5pHxcuAw==; 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 1h18L9-0005Bv-3v; Tue, 05 Mar 2019 11:34:31 +0000 Received: from out1.zte.com.cn ([202.103.147.172] helo=mxct.zte.com.cn) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1h18Js-0003T5-Pn for linux-arm-kernel@lists.infradead.org; Tue, 05 Mar 2019 11:33:19 +0000 Received: from mse01.zte.com.cn (unknown [10.30.3.20]) by Forcepoint Email with ESMTPS id 2DDB48AC1D2DE8684F20; Tue, 5 Mar 2019 19:33:11 +0800 (CST) Received: from notes_smtp.zte.com.cn ([10.30.1.239]) by mse01.zte.com.cn with ESMTP id x25BX3XV072444; Tue, 5 Mar 2019 19:33:03 +0800 (GMT-8) (envelope-from wen.yang99@zte.com.cn) Received: from fox-host8.localdomain ([10.74.120.8]) by szsmtp06.zte.com.cn (Lotus Domino Release 8.5.3FP6) with ESMTP id 2019030519331902-3291608 ; Tue, 5 Mar 2019 19:33:19 +0800 From: Wen Yang To: linux-kernel@vger.kernel.org Subject: [PATCH v2 09/15] ARM: socfpga: fix a leaked reference by adding missing of_node_put Date: Tue, 5 Mar 2019 19:34:00 +0800 Message-Id: <1551785646-46173-9-git-send-email-wen.yang99@zte.com.cn> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1551785646-46173-1-git-send-email-wen.yang99@zte.com.cn> References: <1551785646-46173-1-git-send-email-wen.yang99@zte.com.cn> X-MIMETrack: Itemize by SMTP Server on SZSMTP06/server/zte_ltd(Release 8.5.3FP6|November 21, 2013) at 2019-03-05 19:33:19, Serialize by Router on notes_smtp/zte_ltd(Release 9.0.1FP7|August 17, 2016) at 2019-03-05 19:32:59, Serialize complete at 2019-03-05 19:32:59 X-MAIL: mse01.zte.com.cn x25BX3XV072444 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190305_033313_705692_FA785857 X-CRM114-Status: GOOD ( 11.81 ) 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: wang.yi59@zte.com.cn, Dinh Nguyen , Wen Yang , linux-arm-kernel@lists.infradead.org, Russell King 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 The call to of_get_next_child returns a node pointer with refcount incremented thus it must be explicitly decremented after the last usage. Detected by coccinelle with the following warnings: ./arch/arm/mach-socfpga/platsmp.c:93:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 85, but without a corresponding object release within this function. Signed-off-by: Wen Yang Reviewed-by: Florian Fainelli Cc: Dinh Nguyen Cc: Russell King Cc: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org --- v2->v1: add a missing space between "adding" and "missing" arch/arm/mach-socfpga/platsmp.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm/mach-socfpga/platsmp.c b/arch/arm/mach-socfpga/platsmp.c index 0ee7677..55c2884 100644 --- a/arch/arm/mach-socfpga/platsmp.c +++ b/arch/arm/mach-socfpga/platsmp.c @@ -89,6 +89,7 @@ static void __init socfpga_smp_prepare_cpus(unsigned int max_cpus) } socfpga_scu_base_addr = of_iomap(np, 0); + of_node_put(np); if (!socfpga_scu_base_addr) return; scu_enable(socfpga_scu_base_addr); From patchwork Tue Mar 5 11:34:01 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wen Yang X-Patchwork-Id: 10839359 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 D21931390 for ; Tue, 5 Mar 2019 11:34:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BDA262BED8 for ; Tue, 5 Mar 2019 11:34:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B278F2BEED; Tue, 5 Mar 2019 11:34:45 +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 3A2652BED8 for ; Tue, 5 Mar 2019 11:34:45 +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=Pl9qHbfd7OJv78z3gyFOMtDFSCqUgl8ttAhQTk97soM=; b=KYxPjH7nXpXBB7igkFJ8UhJR2/ pPAiU22wpjQWY8aBqHpHB3jFUUS9IIsYbj+wA04HqtHwmS4noQUyVOSSFRMIxpRlddTo/el/Y65E2 fwZnqldkzigsAXU1FA830PQ6QhNgC2Mf+EzUoup5wzDYIZnwh4hH9Dr32xIl3dC8a45LT2dSAIvHg Rl9zN2iwWZn16veNY5/Hc+V526hv46sQ8zk2aerWFPNkQuDOr+d8/jGqUA2hjBjKL0jhdXoR9CT6e dUke+UO9o0tUw5MxCoE0oADPejPf6qKLAsCZqgGE9HnM8v2lqI4imiW5yPpcqJy6GJwxrD072QqF9 LIOnFzmw==; 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 1h18LL-0005X0-Ge; Tue, 05 Mar 2019 11:34:43 +0000 Received: from mxhk.zte.com.cn ([63.217.80.70]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1h18Jt-0003UE-BE for linux-arm-kernel@lists.infradead.org; Tue, 05 Mar 2019 11:33:23 +0000 Received: from mse01.zte.com.cn (unknown [10.30.3.20]) by Forcepoint Email with ESMTPS id D20DC7501B3B447A6FBE; Tue, 5 Mar 2019 19:33:11 +0800 (CST) Received: from notes_smtp.zte.com.cn ([10.30.1.239]) by mse01.zte.com.cn with ESMTP id x25BX46U072474; Tue, 5 Mar 2019 19:33:04 +0800 (GMT-8) (envelope-from wen.yang99@zte.com.cn) Received: from fox-host8.localdomain ([10.74.120.8]) by szsmtp06.zte.com.cn (Lotus Domino Release 8.5.3FP6) with ESMTP id 2019030519332021-3291618 ; Tue, 5 Mar 2019 19:33:20 +0800 From: Wen Yang To: linux-kernel@vger.kernel.org Subject: [PATCH v2 10/15] ARM: sunxi: fix a leaked reference by adding missing of_node_put Date: Tue, 5 Mar 2019 19:34:01 +0800 Message-Id: <1551785646-46173-10-git-send-email-wen.yang99@zte.com.cn> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1551785646-46173-1-git-send-email-wen.yang99@zte.com.cn> References: <1551785646-46173-1-git-send-email-wen.yang99@zte.com.cn> X-MIMETrack: Itemize by SMTP Server on SZSMTP06/server/zte_ltd(Release 8.5.3FP6|November 21, 2013) at 2019-03-05 19:33:20, Serialize by Router on notes_smtp/zte_ltd(Release 9.0.1FP7|August 17, 2016) at 2019-03-05 19:33:00, Serialize complete at 2019-03-05 19:33:00 X-MAIL: mse01.zte.com.cn x25BX46U072474 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190305_033313_977449_22AE084D X-CRM114-Status: GOOD ( 12.59 ) 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: wang.yi59@zte.com.cn, Maxime Ripard , Russell King , Chen-Yu Tsai , Wen Yang , 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 The call to of_get_next_child returns a node pointer with refcount incremented thus it must be explicitly decremented after the last usage. Detected by coccinelle with the following warnings: ./arch/arm/mach-sunxi/platsmp.c:55:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 46, but without a corresponding object release within this function. ./arch/arm/mach-sunxi/platsmp.c:138:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 129, but without a corresponding object release within this function. Signed-off-by: Wen Yang Reviewed-by: Florian Fainelli Cc: Maxime Ripard Cc: Chen-Yu Tsai Cc: Russell King Cc: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org --- v2->v1: add a missing space between "adding" and "missing" arch/arm/mach-sunxi/platsmp.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/arm/mach-sunxi/platsmp.c b/arch/arm/mach-sunxi/platsmp.c index 8fb5088..c842209 100644 --- a/arch/arm/mach-sunxi/platsmp.c +++ b/arch/arm/mach-sunxi/platsmp.c @@ -50,6 +50,7 @@ static void __init sun6i_smp_prepare_cpus(unsigned int max_cpus) } prcm_membase = of_iomap(node, 0); + of_node_put(node); if (!prcm_membase) { pr_err("Couldn't map A31 PRCM registers\n"); return; @@ -63,6 +64,7 @@ static void __init sun6i_smp_prepare_cpus(unsigned int max_cpus) } cpucfg_membase = of_iomap(node, 0); + of_node_put(node); if (!cpucfg_membase) pr_err("Couldn't map A31 CPU config registers\n"); From patchwork Tue Mar 5 11:34:02 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wen Yang X-Patchwork-Id: 10839363 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 16A0D139A for ; Tue, 5 Mar 2019 11:35:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 01FC22835B for ; Tue, 5 Mar 2019 11:35:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EA8F92B3EC; Tue, 5 Mar 2019 11:34:59 +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 93F252835B for ; Tue, 5 Mar 2019 11:34:59 +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=vAhbInF/G6IxU1wm2Cf1FpINGkmcQfYtd2+2hQ4UcWc=; b=CKRHRIOiNofzkK6FzQkJXUkb9u Z7nWAzKyef4rm/RYZAJiOTb8FDHutxHD4Gplu6pqvLVMpUREuYJJdzsunwvTg+lhj/Cq7lI+LAWZ3 41EI1a8mRj3Nv/cpMzYspBuKsEpiAUOH/hq2+GSdZQ++7ZWZtiUTysZCzgLRk0SE4KlOO1TqrPXzg 4vo1HozAdjtgFtf5GX3peshjCmt6C8gAeJwi/QeiWmX7EfOGyV5sPA4nlxeG4k+TVWhbWtMgp9Ncl NZpmdm3ls49lC3nbN5ye6QhxQCzQPm0H18CHRkHaSNp0MyCdqFranOmh54v42VpBB9LtItrLnG1jl Fv+sQa4g==; 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 1h18LW-0005ll-AE; Tue, 05 Mar 2019 11:34:54 +0000 Received: from out1.zte.com.cn ([202.103.147.172] helo=mxct.zte.com.cn) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1h18Ju-0003VI-9n for linux-arm-kernel@lists.infradead.org; Tue, 05 Mar 2019 11:33:25 +0000 Received: from mse01.zte.com.cn (unknown [10.30.3.20]) by Forcepoint Email with ESMTPS id 7EDDDD58223DA31DDDB1; Tue, 5 Mar 2019 19:33:12 +0800 (CST) Received: from notes_smtp.zte.com.cn ([10.30.1.239]) by mse01.zte.com.cn with ESMTP id x25BX5pD072493; Tue, 5 Mar 2019 19:33:05 +0800 (GMT-8) (envelope-from wen.yang99@zte.com.cn) Received: from fox-host8.localdomain ([10.74.120.8]) by szsmtp06.zte.com.cn (Lotus Domino Release 8.5.3FP6) with ESMTP id 2019030519332133-3291629 ; Tue, 5 Mar 2019 19:33:21 +0800 From: Wen Yang To: linux-kernel@vger.kernel.org Subject: [PATCH v2 11/15] ARM: versatile: fix a leaked reference by adding missing of_node_put Date: Tue, 5 Mar 2019 19:34:02 +0800 Message-Id: <1551785646-46173-11-git-send-email-wen.yang99@zte.com.cn> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1551785646-46173-1-git-send-email-wen.yang99@zte.com.cn> References: <1551785646-46173-1-git-send-email-wen.yang99@zte.com.cn> X-MIMETrack: Itemize by SMTP Server on SZSMTP06/server/zte_ltd(Release 8.5.3FP6|November 21, 2013) at 2019-03-05 19:33:21, Serialize by Router on notes_smtp/zte_ltd(Release 9.0.1FP7|August 17, 2016) at 2019-03-05 19:33:01, Serialize complete at 2019-03-05 19:33:01 X-MAIL: mse01.zte.com.cn x25BX5pD072493 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190305_033314_849895_68A62078 X-CRM114-Status: GOOD ( 12.94 ) 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: wang.yi59@zte.com.cn, Linus Walleij , Wen Yang , linux-arm-kernel@lists.infradead.org, Russell King 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 The call to of_get_next_child returns a node pointer with refcount incremented thus it must be explicitly decremented after the last usage. Detected by coccinelle with the following warnings: ./arch/arm/mach-versatile/versatile_dt.c:315:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 302, but without a corresponding object release within this function. ./arch/arm/mach-versatile/versatile_dt.c:320:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 302, but without a corresponding object release within this function. Signed-off-by: Wen Yang Reviewed-by: Florian Fainelli Cc: Linus Walleij Cc: Russell King Cc: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org --- v2->v1: add a missing space between "adding" and "missing" arch/arm/mach-versatile/versatile_dt.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/arch/arm/mach-versatile/versatile_dt.c b/arch/arm/mach-versatile/versatile_dt.c index e9d6068..028463a 100644 --- a/arch/arm/mach-versatile/versatile_dt.c +++ b/arch/arm/mach-versatile/versatile_dt.c @@ -312,12 +312,12 @@ static void __init versatile_dt_pci_init(void) * driver had it so we will keep it. */ writel(1, versatile_sys_base + VERSATILE_SYS_PCICTL_OFFSET); - return; + goto out_put_node; } newprop = kzalloc(sizeof(*newprop), GFP_KERNEL); if (!newprop) - return; + goto out_put_node; newprop->name = kstrdup("status", GFP_KERNEL); newprop->value = kstrdup("disabled", GFP_KERNEL); @@ -325,6 +325,9 @@ static void __init versatile_dt_pci_init(void) of_update_property(np, newprop); pr_info("Not plugged into PCI backplane!\n"); + +out_put_node: + of_node_put(np); } static void __init versatile_dt_init(void) From patchwork Tue Mar 5 11:34:03 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wen Yang X-Patchwork-Id: 10839365 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 1267F139A for ; Tue, 5 Mar 2019 11:35:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F001E2835B for ; Tue, 5 Mar 2019 11:35:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E462E2B3EC; Tue, 5 Mar 2019 11:35:16 +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 8A5512835B for ; Tue, 5 Mar 2019 11:35:16 +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=DcL4QLFEF1ujyrRQI2rrChDeJcq6xnab2HKBy+ulFDk=; b=lrzu3/ESt4oQEbUvFj3EEriXLK KOKqjUn1d8qLBOndIJXua5bS1owrtF+7t1Y6yJEjIHCnMx4aAVAHLGk3LfQkDzyk+hknNUYTwvcPE mrz1BYU79v4q55oieegywBxE+KMQ7ZektfBJd6zDU1r0iWpG4Uk1e7zCVAMYQPssJAPUJowf/XHq8 eKtVTF1q3oDjOlI3GpSCO0DRi2g1gljcOdBg+kM3vqu9EdGunKRXjhJXnQxCs6INymVfpXqi1rwlA 9rdUC8K/b1Fr7hAlCW2HnT9B44EbTr2CaYvTM+H7GoNaADmJfiEIBcU71XesNV2c2zg3/utP1Vv+L BLHUHSAg==; 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 1h18Lp-0006mP-IE; Tue, 05 Mar 2019 11:35:13 +0000 Received: from mxhk.zte.com.cn ([63.217.80.70]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1h18Ju-0003Ws-Ne for linux-arm-kernel@lists.infradead.org; Tue, 05 Mar 2019 11:33:27 +0000 Received: from mse01.zte.com.cn (unknown [10.30.3.20]) by Forcepoint Email with ESMTPS id 35D5BFC0C1B180533BB0; Tue, 5 Mar 2019 19:33:13 +0800 (CST) Received: from notes_smtp.zte.com.cn ([10.30.1.239]) by mse01.zte.com.cn with ESMTP id x25BX6KP072508; Tue, 5 Mar 2019 19:33:06 +0800 (GMT-8) (envelope-from wen.yang99@zte.com.cn) Received: from fox-host8.localdomain ([10.74.120.8]) by szsmtp06.zte.com.cn (Lotus Domino Release 8.5.3FP6) with ESMTP id 2019030519332241-3291637 ; Tue, 5 Mar 2019 19:33:22 +0800 From: Wen Yang To: linux-kernel@vger.kernel.org Subject: [PATCH v2 12/15] ARM: vexpress: fix a leaked reference by adding missing of_node_put Date: Tue, 5 Mar 2019 19:34:03 +0800 Message-Id: <1551785646-46173-12-git-send-email-wen.yang99@zte.com.cn> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1551785646-46173-1-git-send-email-wen.yang99@zte.com.cn> References: <1551785646-46173-1-git-send-email-wen.yang99@zte.com.cn> X-MIMETrack: Itemize by SMTP Server on SZSMTP06/server/zte_ltd(Release 8.5.3FP6|November 21, 2013) at 2019-03-05 19:33:22, Serialize by Router on notes_smtp/zte_ltd(Release 9.0.1FP7|August 17, 2016) at 2019-03-05 19:33:02, Serialize complete at 2019-03-05 19:33:02 X-MAIL: mse01.zte.com.cn x25BX6KP072508 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190305_033315_548938_0285D6EC X-CRM114-Status: GOOD ( 11.91 ) 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: wang.yi59@zte.com.cn, Lorenzo Pieralisi , Liviu Dudau , Russell King , Sudeep Holla , Wen Yang , 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 The call to of_get_next_child returns a node pointer with refcount incremented thus it must be explicitly decremented after the last usage. Detected by coccinelle with the following warnings: ./arch/arm/mach-vexpress/dcscb.c:150:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 145, but without a corresponding object release within this function. ./arch/arm/mach-vexpress/dcscb.c:160:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 145, but without a corresponding object release within this function. ./arch/arm/mach-vexpress/dcscb.c:171:1-7: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 145, but without a corresponding object release within this function. Signed-off-by: Wen Yang Reviewed-by: Florian Fainelli Cc: Liviu Dudau Cc: Sudeep Holla Cc: Lorenzo Pieralisi Cc: Russell King Cc: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org --- v2->v1: add a missing space between "adding" and "missing" arch/arm/mach-vexpress/dcscb.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm/mach-vexpress/dcscb.c b/arch/arm/mach-vexpress/dcscb.c index ee2a0fa..aaade91 100644 --- a/arch/arm/mach-vexpress/dcscb.c +++ b/arch/arm/mach-vexpress/dcscb.c @@ -146,6 +146,7 @@ static int __init dcscb_init(void) if (!node) return -ENODEV; dcscb_base = of_iomap(node, 0); + of_node_put(node); if (!dcscb_base) return -EADDRNOTAVAIL; cfg = readl_relaxed(dcscb_base + DCS_CFG_R); From patchwork Tue Mar 5 11:34:04 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wen Yang X-Patchwork-Id: 10839367 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 6B9751390 for ; Tue, 5 Mar 2019 11:35:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 56EF92835B for ; Tue, 5 Mar 2019 11:35:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4B6952B3EC; Tue, 5 Mar 2019 11:35:31 +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 F3F022835B for ; Tue, 5 Mar 2019 11:35:30 +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=dIchg/0lR2YCu8yiBAFbdU1QGj97p6ispQYjhhNMxKU=; b=DbErLtRanJ3NGzOBp/qpqgxplw QQrJFZ+WMUwEnp1OQXUwql1RnkXeLB+0lgj65NsfohE4iutSQvg2WIx5g4b5beVQEtL4tQvhUolsN SKA7926UiSfZnq/xpRN8ESDoSP7Up7SL1nYPQhgUwCngXsqGq+YY5yBnKjpOYdjbrfNh4futZc2wD yG+JLKyOh4suWN+ci6MHoi6SqDnc0hHHen5B4ahahrbWcmaJtvqp0oJ5WaNhENz+Ml5AljzbomZ8c 3e36OKc8EprQWt1/pOSEBvQVLtjpSFiNglZDQOplIvEGikoAI+kmIX5FaIctQyTf6oiMtzaeIRULH FFqHpv5Q==; 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 1h18M0-0007UG-W1; Tue, 05 Mar 2019 11:35:25 +0000 Received: from out1.zte.com.cn ([202.103.147.172] helo=mxct.zte.com.cn) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1h18Jw-0003Zy-KN for linux-arm-kernel@lists.infradead.org; Tue, 05 Mar 2019 11:33:31 +0000 Received: from mse01.zte.com.cn (unknown [10.30.3.20]) by Forcepoint Email with ESMTPS id 404D6E9841A80AEBACC8; Tue, 5 Mar 2019 19:33:15 +0800 (CST) Received: from notes_smtp.zte.com.cn ([10.30.1.239]) by mse01.zte.com.cn with ESMTP id x25BX7jO072540; Tue, 5 Mar 2019 19:33:07 +0800 (GMT-8) (envelope-from wen.yang99@zte.com.cn) Received: from fox-host8.localdomain ([10.74.120.8]) by szsmtp06.zte.com.cn (Lotus Domino Release 8.5.3FP6) with ESMTP id 2019030519332348-3291660 ; Tue, 5 Mar 2019 19:33:23 +0800 From: Wen Yang To: linux-kernel@vger.kernel.org Subject: [PATCH v2 13/15] ARM: zynq: fix a leaked reference by adding missing of_node_put Date: Tue, 5 Mar 2019 19:34:04 +0800 Message-Id: <1551785646-46173-13-git-send-email-wen.yang99@zte.com.cn> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1551785646-46173-1-git-send-email-wen.yang99@zte.com.cn> References: <1551785646-46173-1-git-send-email-wen.yang99@zte.com.cn> X-MIMETrack: Itemize by SMTP Server on SZSMTP06/server/zte_ltd(Release 8.5.3FP6|November 21, 2013) at 2019-03-05 19:33:23, Serialize by Router on notes_smtp/zte_ltd(Release 9.0.1FP7|August 17, 2016) at 2019-03-05 19:33:03, Serialize complete at 2019-03-05 19:33:03 X-MAIL: mse01.zte.com.cn x25BX7jO072540 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190305_033317_256603_FCCDDA59 X-CRM114-Status: GOOD ( 12.06 ) 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: wang.yi59@zte.com.cn, Michal Simek , Wen Yang , linux-arm-kernel@lists.infradead.org, Russell King 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 The call to of_get_next_child returns a node pointer with refcount incremented thus it must be explicitly decremented after the last usage. Detected by coccinelle with the following warnings: ./arch/arm/mach-zynq/common.c:89:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 80, but without a corresponding object release within this function. ./arch/arm/mach-zynq/common.c:98:1-7: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 80, but without a corresponding object release within this function. Signed-off-by: Wen Yang Reviewed-by: Florian Fainelli Cc: Russell King Cc: Michal Simek Cc: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org --- v2->v1: add a missing space between "adding" and "missing" arch/arm/mach-zynq/common.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm/mach-zynq/common.c b/arch/arm/mach-zynq/common.c index 6aba9eb..a8b1b9c 100644 --- a/arch/arm/mach-zynq/common.c +++ b/arch/arm/mach-zynq/common.c @@ -84,6 +84,7 @@ static int __init zynq_get_revision(void) } zynq_devcfg_base = of_iomap(np, 0); + of_node_put(np); if (!zynq_devcfg_base) { pr_err("%s: Unable to map I/O memory\n", __func__); return -1; From patchwork Tue Mar 5 11:34:05 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wen Yang X-Patchwork-Id: 10839369 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 2C150139A for ; Tue, 5 Mar 2019 11:35:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 177312835B for ; Tue, 5 Mar 2019 11:35:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0C0582B3EC; Tue, 5 Mar 2019 11:35:40 +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 B6C302835B for ; Tue, 5 Mar 2019 11:35:39 +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=yE3VWTgxTeOD1wCAtKtviHitvia/ULXZgRhCXuxFV0g=; b=lvpeI6eR5iLCW5Mt9YYN4AXUIj AKbV0iSH2YcsGfFSkBbU+7MtUPp6BQRlAQd5pV+yOtJOhhHTogapaAauYPC07lB3Or0I37dtry/uO j1HQLCh+RqoKKMjSyOMRVqyTPRT28WB4yKexYWrxCzknrtA+3mxmdLPnkTPtQJUFc8ILQmBbdUvIy BvRdQZSylo8VQNv48GdHxA9CAt9jv6STu4A0TIiTGDB4JWL/Exo9OQChkApuukglIrI09l++q5K/T WyNGciLa1Zjzgk/dFzWIeyWWc7ZJ5SfAWcNQuSkxHkWGMpkB5idB5PmPvPRMLOIN0flXdfkcCYKE8 yo6QB3fA==; 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 1h18MA-0007ik-Np; Tue, 05 Mar 2019 11:35:34 +0000 Received: from out1.zte.com.cn ([202.103.147.172] helo=mxct.zte.com.cn) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1h18Jx-0003ar-6h for linux-arm-kernel@lists.infradead.org; Tue, 05 Mar 2019 11:33:31 +0000 Received: from mse01.zte.com.cn (unknown [10.30.3.20]) by Forcepoint Email with ESMTPS id D9638C8C65E591F4FE46; Tue, 5 Mar 2019 19:33:15 +0800 (CST) Received: from notes_smtp.zte.com.cn ([10.30.1.239]) by mse01.zte.com.cn with ESMTP id x25BX8XS072571; Tue, 5 Mar 2019 19:33:08 +0800 (GMT-8) (envelope-from wen.yang99@zte.com.cn) Received: from fox-host8.localdomain ([10.74.120.8]) by szsmtp06.zte.com.cn (Lotus Domino Release 8.5.3FP6) with ESMTP id 2019030519332458-3291704 ; Tue, 5 Mar 2019 19:33:24 +0800 From: Wen Yang To: linux-kernel@vger.kernel.org Subject: [PATCH v2 14/15] arm64: cpu_ops: fix a leaked reference by adding missing of_node_put Date: Tue, 5 Mar 2019 19:34:05 +0800 Message-Id: <1551785646-46173-14-git-send-email-wen.yang99@zte.com.cn> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1551785646-46173-1-git-send-email-wen.yang99@zte.com.cn> References: <1551785646-46173-1-git-send-email-wen.yang99@zte.com.cn> X-MIMETrack: Itemize by SMTP Server on SZSMTP06/server/zte_ltd(Release 8.5.3FP6|November 21, 2013) at 2019-03-05 19:33:24, Serialize by Router on notes_smtp/zte_ltd(Release 9.0.1FP7|August 17, 2016) at 2019-03-05 19:33:04, Serialize complete at 2019-03-05 19:33:04 X-MAIL: mse01.zte.com.cn x25BX8XS072571 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190305_033318_183884_171F476F X-CRM114-Status: GOOD ( 11.46 ) 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: wang.yi59@zte.com.cn, Catalin Marinas , Will Deacon , Wen Yang , 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 The call to of_get_next_child returns a node pointer with refcount incremented thus it must be explicitly decremented after the last usage. Detected by coccinelle with the following warnings: ./arch/arm64/kernel/cpu_ops.c:102:1-7: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 69, but without a corresponding object release within this function. Signed-off-by: Wen Yang Reviewed-by: Florian Fainelli Cc: Catalin Marinas Cc: Will Deacon Cc: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org Acked-by: Will Deacon --- v2->v1: add a missing space between "adding" and "missing" arch/arm64/kernel/cpu_ops.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm64/kernel/cpu_ops.c b/arch/arm64/kernel/cpu_ops.c index ea00124..00f8b86 100644 --- a/arch/arm64/kernel/cpu_ops.c +++ b/arch/arm64/kernel/cpu_ops.c @@ -85,6 +85,7 @@ static const char *__init cpu_read_enable_method(int cpu) pr_err("%pOF: missing enable-method property\n", dn); } + of_node_put(dn); } else { enable_method = acpi_get_enable_method(cpu); if (!enable_method) { From patchwork Tue Mar 5 11:34:06 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wen Yang X-Patchwork-Id: 10839371 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 68630139A for ; Tue, 5 Mar 2019 11:35:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 537E82835B for ; Tue, 5 Mar 2019 11:35:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 47DB02B3EC; Tue, 5 Mar 2019 11:35:52 +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 CE94F289CF for ; Tue, 5 Mar 2019 11:35:51 +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=4WbBIlMvhTLAyDuLpNn4YOSPeZ8j/tPvPCCo9M0IdTI=; b=sQ5Yy1zF8BZW/TKazigMIp8IGo ynQWGZ4ZD0ImK9Kk2gEsmGAMNsPMXYAaanAxRLW/XsAhIsD6VN+Rfc7vPj6xjbPoXjxA3O2po9AVn KW92rQSRHyu9/q+Aqzk+f4bLn6ckeBoTo/0uMfAWDQK1VoQk+sv/45mUhE2A5/WI46SyI29mV+Nu/ 2U3ptRQ3yBH1IytQdaDeW0orLAgTyuzC5HpE2F2kF8MxrmpCsQVHZuJ9Z9oEyjqCrPCYdu0gI3K9f UDK5MJFb+ZL5zmmrVMKPtYo2+5bAqELH7m5WMBJarYCDV1E7SzL0YIPJdDBY9jECbhsQzf3EuqthX +ofWt4og==; 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 1h18ML-0007xQ-Iv; Tue, 05 Mar 2019 11:35:45 +0000 Received: from mxhk.zte.com.cn ([63.217.80.70]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1h18Jy-0003bu-8t for linux-arm-kernel@lists.infradead.org; Tue, 05 Mar 2019 11:33:35 +0000 Received: from mse01.zte.com.cn (unknown [10.30.3.20]) by Forcepoint Email with ESMTPS id AE70565EA93192A98AFE; Tue, 5 Mar 2019 19:33:16 +0800 (CST) Received: from notes_smtp.zte.com.cn ([10.30.1.239]) by mse01.zte.com.cn with ESMTP id x25BX9cF072592; Tue, 5 Mar 2019 19:33:09 +0800 (GMT-8) (envelope-from wen.yang99@zte.com.cn) Received: from fox-host8.localdomain ([10.74.120.8]) by szsmtp06.zte.com.cn (Lotus Domino Release 8.5.3FP6) with ESMTP id 2019030519332558-3291746 ; Tue, 5 Mar 2019 19:33:25 +0800 From: Wen Yang To: linux-kernel@vger.kernel.org Subject: [PATCH v2 15/15] ARM: axxia: fix a leaked reference by adding missing of_node_put Date: Tue, 5 Mar 2019 19:34:06 +0800 Message-Id: <1551785646-46173-15-git-send-email-wen.yang99@zte.com.cn> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1551785646-46173-1-git-send-email-wen.yang99@zte.com.cn> References: <1551785646-46173-1-git-send-email-wen.yang99@zte.com.cn> X-MIMETrack: Itemize by SMTP Server on SZSMTP06/server/zte_ltd(Release 8.5.3FP6|November 21, 2013) at 2019-03-05 19:33:25, Serialize by Router on notes_smtp/zte_ltd(Release 9.0.1FP7|August 17, 2016) at 2019-03-05 19:33:05, Serialize complete at 2019-03-05 19:33:05 X-MAIL: mse01.zte.com.cn x25BX9cF072592 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190305_033319_283642_65A713DC X-CRM114-Status: GOOD ( 12.11 ) 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: wang.yi59@zte.com.cn, Wen Yang , linux-arm-kernel@lists.infradead.org, Russell King 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 The call to of_get_next_child returns a node pointer with refcount incremented thus it must be explicitly decremented after the last usage. Detected by coccinelle with the following warnings: ./arch/arm/mach-axxia/platsmp.c:46:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 40, but without a corresponding object release within this function. ./arch/arm/mach-axxia/platsmp.c:53:1-7: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 40, but without a corresponding object release within this function. Signed-off-by: Wen Yang Reviewed-by: Florian Fainelli Cc: Russell King Cc: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org --- v2->v1: add a missing space between "adding" and "missing" arch/arm/mach-axxia/platsmp.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm/mach-axxia/platsmp.c b/arch/arm/mach-axxia/platsmp.c index 502e3df..c706a11 100644 --- a/arch/arm/mach-axxia/platsmp.c +++ b/arch/arm/mach-axxia/platsmp.c @@ -42,6 +42,7 @@ static int axxia_boot_secondary(unsigned int cpu, struct task_struct *idle) return -ENOENT; syscon = of_iomap(syscon_np, 0); + of_node_put(syscon_np); if (!syscon) return -ENOMEM;