From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.1 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 98AB0C10F14 for ; Sun, 21 Apr 2019 17:24:30 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 638A32080D for ; Sun, 21 Apr 2019 17:24:30 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="YST5eS3R" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 638A32080D Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=bootlin.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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:References :In-Reply-To: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=uUZh1b+0rN/fuHWLrjAIrGP4704Ks/fjjdNf/TuuiRI=; b=YST5eS3Rg2h3A2 13ilcRTC23r2WGh2uE1uCkuG7jPVPi8lbQNvIdT4XwLozVX0dtTek/B4xGU8BEYeUkYkNkDdSGC9r GThBYxG1A5SZVJrU/4e9ULlFphPa7OZyTnUH3GeLHYSjU3vuMqh7xdpav+0H4Tj8AxLdpbtluIk5N S3V0nDo2itNRd15rfjHvtr4SbbacPf+5NsQCI1BuWwlebpz+sGqCq7D3vkq9R5vadl2zZrrywiAvl xVewPXBsbMqoZfmnHa/q2as+E2IjipIor1ZTh4pvrYBfdHnR0BImvRuw4q7ZE1vgJvXv8Nt4Dl1u5 SRm2Ig5MOE13IPLDWbuQ==; 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 1hIGCW-0007G7-MX; Sun, 21 Apr 2019 17:24:24 +0000 Received: from relay1-d.mail.gandi.net ([217.70.183.193]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hIGCT-0007FI-GH for linux-arm-kernel@lists.infradead.org; Sun, 21 Apr 2019 17:24:23 +0000 X-Originating-IP: 93.23.249.69 Received: from localhost (69.249.23.93.rev.sfr.net [93.23.249.69]) (Authenticated sender: gregory.clement@bootlin.com) by relay1-d.mail.gandi.net (Postfix) with ESMTPSA id A7977240002; Sun, 21 Apr 2019 17:24:18 +0000 (UTC) From: Gregory CLEMENT To: Wen Yang , linux-kernel@vger.kernel.org Subject: Re: [PATCH 2/4] ARM: mvebu: fix a leaked reference by adding missing of_node_put In-Reply-To: <1551785577-45896-2-git-send-email-wen.yang99@zte.com.cn> References: <1551785577-45896-1-git-send-email-wen.yang99@zte.com.cn> <1551785577-45896-2-git-send-email-wen.yang99@zte.com.cn> Date: Sun, 21 Apr 2019 19:24:17 +0200 Message-ID: <877ebn8e66.fsf@FE-laptop> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190421_102421_686966_222B4BE7 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, Andrew Lunn , Jason Cooper , Russell King , Wen Yang , linux-arm-kernel@lists.infradead.org, Sebastian Hesselbarth Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi Wen Yang, > 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-mvebu/pm-board.c:135:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 88, but without a corresponding object release within this functio > > Signed-off-by: Wen Yang > Cc: Jason Cooper > Cc: Andrew Lunn > Cc: Gregory Clement > Cc: Sebastian Hesselbarth > Cc: Russell King > Cc: linux-arm-kernel@lists.infradead.org > Cc: linux-kernel@vger.kernel.org Applied on mvebu/arm Thanks, Gregory > --- > arch/arm/mach-mvebu/pm-board.c | 11 ++++++++--- > 1 file changed, 8 insertions(+), 3 deletions(-) > > diff --git a/arch/arm/mach-mvebu/pm-board.c b/arch/arm/mach-mvebu/pm-board.c > index db17121..1e2c17c 100644 > --- a/arch/arm/mach-mvebu/pm-board.c > +++ b/arch/arm/mach-mvebu/pm-board.c > @@ -79,7 +79,7 @@ static void mvebu_armada_pm_enter(void __iomem *sdram_reg, u32 srcmd) > static int __init mvebu_armada_pm_init(void) > { > struct device_node *np; > - struct device_node *gpio_ctrl_np; > + struct device_node *gpio_ctrl_np = NULL; > int ret = 0, i; > > if (!of_machine_is_compatible("marvell,axp-gp")) > @@ -126,18 +126,23 @@ static int __init mvebu_armada_pm_init(void) > goto out; > } > > + if(gpio_ctrl_np) > + of_node_put(gpio_ctrl_np); > gpio_ctrl_np = args.np; > pic_raw_gpios[i] = args.args[0]; > } > > gpio_ctrl = of_iomap(gpio_ctrl_np, 0); > - if (!gpio_ctrl) > - return -ENOMEM; > + if (!gpio_ctrl) { > + ret = -ENOMEM; > + goto out; > + } > > mvebu_pm_suspend_init(mvebu_armada_pm_enter); > > out: > of_node_put(np); > + of_node_put(gpio_ctrl_np); > return ret; > } > > -- > 2.9.5 > -- Gregory Clement, Bootlin Embedded Linux and Kernel engineering http://bootlin.com _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel