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=-9.1 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham 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 A257DC282DC for ; Wed, 22 May 2019 19:27:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 769A620675 for ; Wed, 22 May 2019 19:27:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1558553222; bh=QhdAarfzTmA6anoCvQ7Aa0lRiqrk8MkX1Str9Wrz+N8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=1s9qmH0OVPt0ERApcyIpCoIlH9B4w2/FU0yLdTIPnRbIuur/Y61SGoFDPtNH8/2+L yNSs3ykEYtqkbZziemoDzjv8ittNayzB8zrEBoEfAqXoafgRUJ7od/3ZepG3djfJIX q1+/h5HjkmSl8vpDhldYxyc97T4wkisS4HCqhyYg= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732219AbfEVT1B (ORCPT ); Wed, 22 May 2019 15:27:01 -0400 Received: from mail.kernel.org ([198.145.29.99]:48618 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731487AbfEVT0x (ORCPT ); Wed, 22 May 2019 15:26:53 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 72301217D7; Wed, 22 May 2019 19:26:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1558553213; bh=QhdAarfzTmA6anoCvQ7Aa0lRiqrk8MkX1Str9Wrz+N8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OtVIDZ16cAup/WZaJDBx1annQQrVUeZhb9woo5GO7DSD5G1WDli44XRhMktX6/uAn twY1QQADMSI2G1PK0JdG8GKWaMHdGOJe+uQlfWnZgAdhCMncMK0O5/A71cFHJuBBUa R7kL8nGEaYowtPVzPeZFAZ03T0jMpQdNIy4h+OXw= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Wen Yang , Linus Walleij , Jun Nie , linux-gpio@vger.kernel.org, Shawn Guo , Sasha Levin Subject: [PATCH AUTOSEL 4.19 016/244] pinctrl: zte: fix leaked of_node references Date: Wed, 22 May 2019 15:22:42 -0400 Message-Id: <20190522192630.24917-16-sashal@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190522192630.24917-1-sashal@kernel.org> References: <20190522192630.24917-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Wen Yang [ Upstream commit 02d15f0d80720545f1f4922a1550ea4aaad4e152 ] The call to of_parse_phandle returns a node pointer with refcount incremented thus it must be explicitly decremented after the last usage. Detected by coccinelle with the following warnings: ./drivers/pinctrl/zte/pinctrl-zx.c:415:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 407, but without a corresponding object release within this function. ./drivers/pinctrl/zte/pinctrl-zx.c:422:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 407, but without a corresponding object release within this function. ./drivers/pinctrl/zte/pinctrl-zx.c:436:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 407, but without a corresponding object release within this function. ./drivers/pinctrl/zte/pinctrl-zx.c:444:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 407, but without a corresponding object release within this function. ./drivers/pinctrl/zte/pinctrl-zx.c:448:1-7: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 407, but without a corresponding object release within this function. Signed-off-by: Wen Yang Cc: Linus Walleij Cc: Jun Nie Cc: Linus Walleij Cc: linux-gpio@vger.kernel.org Cc: linux-kernel@vger.kernel.org Acked-by: Shawn Guo Signed-off-by: Linus Walleij Signed-off-by: Sasha Levin --- drivers/pinctrl/zte/pinctrl-zx.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/pinctrl/zte/pinctrl-zx.c b/drivers/pinctrl/zte/pinctrl-zx.c index caa44dd2880a8..3cb69309912ba 100644 --- a/drivers/pinctrl/zte/pinctrl-zx.c +++ b/drivers/pinctrl/zte/pinctrl-zx.c @@ -411,6 +411,7 @@ int zx_pinctrl_init(struct platform_device *pdev, } zpctl->aux_base = of_iomap(np, 0); + of_node_put(np); if (!zpctl->aux_base) return -ENOMEM; -- 2.20.1