Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp10012535rwb; Thu, 24 Nov 2022 23:16:41 -0800 (PST) X-Google-Smtp-Source: AA0mqf5574WZDnp4D466J6yU2Y/F/Q1Be0y1/Z57Eq+aDe5lCkKu71KCd8WFXgiieLvAW/f+A7WZ X-Received: by 2002:a17:907:1308:b0:7a3:9fca:785d with SMTP id vj8-20020a170907130800b007a39fca785dmr14982701ejb.303.1669360601124; Thu, 24 Nov 2022 23:16:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669360601; cv=none; d=google.com; s=arc-20160816; b=YZjxgWUCMyE44ky0ns+VoZ7XPsekfK1TSnmlWSdxBu+6WPuqUJIRmAAgLLTXgnpLod Bm9MDHmlgjyJ8dGxzaLyHTwBWcVBeph0iuYFj1o8un6CHSGoPUKy8KScD8FlGHVOxOPR pI8Wwf7uWkcrAGZV3ZJQTSoEBRBRtf5mjOnWe3SkvKH5OvtzTcp0H8dPFp4jZ/agr7ld kRGKzxODx1GpDWSiXFuPYy+wdL6C3rFRWW0YApM4QMkl0TKhTi5OSX89vC344m5C/NGz n1NYaCDF2mYUywMvf/VtpsHU31DllDvBeCAyB7qdIBbYWvjoIONa77aD/k9xqpKDIzK0 Jolg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=EzOO5UGpzcH7HOiFSKYvFeUNKglGhJK22Gih0zoZ3nQ=; b=GMBpH+BMYfoLvlMvWMD3mvgVZ5Ce2T/oXB8Phm+26l1voeMWy4dn3PGbabsWFQ38PB Za5MN/+mP6DQNkowH0eghu8i0s6eB7J1RBiRDIkR1ED0ugodt7TtjwSlNFuLaRmkyTtK 20HPAoCuZwFl2seoVWi/57oLxvQB3rDayCEQH+2u+qPN+rYE//Ydacx3hTQH1QRrM4jn 7wnXr1MzqAPWGGlMZKmySnCJloT7sZd8BCCt3kpjKMoiRIo4yowntmjiVeF0ROg+9HON f8OribjdN00k52JJIfJxqRrdGf82zl6Ey7j8Sj859cj9ZG1y9SuTA6XwuVXItkgTWcCv aiCQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g9-20020a1709065d0900b007adac36e031si3020021ejt.442.2022.11.24.23.16.20; Thu, 24 Nov 2022 23:16:41 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229535AbiKYHCI (ORCPT + 87 others); Fri, 25 Nov 2022 02:02:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60694 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229469AbiKYHCG (ORCPT ); Fri, 25 Nov 2022 02:02:06 -0500 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A514D201A0; Thu, 24 Nov 2022 23:02:04 -0800 (PST) Received: from dggemv711-chm.china.huawei.com (unknown [172.30.72.57]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4NJQkw6d7kzmW4H; Fri, 25 Nov 2022 15:01:28 +0800 (CST) Received: from kwepemm600020.china.huawei.com (7.193.23.147) by dggemv711-chm.china.huawei.com (10.1.198.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Fri, 25 Nov 2022 15:02:02 +0800 Received: from localhost.localdomain (10.175.112.125) by kwepemm600020.china.huawei.com (7.193.23.147) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Fri, 25 Nov 2022 15:02:01 +0800 From: Peng Zhang To: , , CC: , , , , ZhangPeng Subject: [PATCH] pinctrl: pinconf-generic: add missing of_node_put() in pinconf_generic_dt_node_to_map() Date: Fri, 25 Nov 2022 07:01:56 +0000 Message-ID: <20221125070156.3535855-1-zhangpeng362@huawei.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.175.112.125] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To kwepemm600020.china.huawei.com (7.193.23.147) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: ZhangPeng of_node_put() needs to be called when jumping out of the loop, since for_each_available_child_of_node() will increase the refcount of node. Fixes: c7289500e29d ("pinctrl: pinconf-generic: scan also referenced phandle node") Signed-off-by: ZhangPeng --- drivers/pinctrl/pinconf-generic.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/pinctrl/pinconf-generic.c b/drivers/pinctrl/pinconf-generic.c index 415d1df8f46a..365c4b0ca465 100644 --- a/drivers/pinctrl/pinconf-generic.c +++ b/drivers/pinctrl/pinconf-generic.c @@ -395,8 +395,10 @@ int pinconf_generic_dt_node_to_map(struct pinctrl_dev *pctldev, for_each_available_child_of_node(np_config, np) { ret = pinconf_generic_dt_subnode_to_map(pctldev, np, map, &reserved_maps, num_maps, type); - if (ret < 0) + if (ret < 0) { + of_node_put(np); goto exit; + } } return 0; -- 2.25.1