Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3572174pxb; Mon, 24 Jan 2022 12:31:24 -0800 (PST) X-Google-Smtp-Source: ABdhPJyjxtU6KoyxuZ89zWDXN8r+lfCMMywdXCPuOQcF4CTMD1S5yc8Kn+f/85ietZO1Orfsmf7S X-Received: by 2002:a65:448a:: with SMTP id l10mr12853864pgq.385.1643056284161; Mon, 24 Jan 2022 12:31:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643056284; cv=none; d=google.com; s=arc-20160816; b=Lli4Kn/6QldtOA7k2LGlINNRCXDAuSk4zcwYsuiD0guVqDotokkbLDMp7erf01XilE BtA4sTadgNmPT9fRWgPV1WOJufNTixzSE9hRckCOT0hZjsGM25zvJJOeUp9+/JC8/zjS 3zIufqIslxA36zcXcElkPq/++qTOdTvnrn02ml014WheN3zqrVcrCsv/6mq5VNK0HAd/ U1FCLZE6QdPv4/up0XMJK0cHhV64iPjNr+rskZVm/O2Ve7piZSJX2+390mjWTsnak4DD zEwms9Nhhm4SeCUo61oQqq1y1TfnM71sKF/DJMlZJpo1s3HE6MLrD2AA3eeXeLobaAwz /nbg== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=5utdgxikeNzUEXDSV6kc71oW3o/UhPMLgEIz0S8Q3nc=; b=gt4bLRyZVxoPeEQCBoxICOp6sO47G2rH++w/LnLnwZhU1YUOxqibCk2zK6K8cUKlyk sUc/URqLbNAkEiuA7Jq06ZJg7c6DMyt9VCGxHYRD76TrjCIwQ+Y4CmhRqbry4U68bhWm ksk5t8sPBsIJiAYbISmZ4CJEYaIgTxJrJTaYsBvNDkbsv8Z4PHf+99jGaXmIpiLxPfn7 EoJokh1Dd86GdCIWu48gsX/KOvjm1TpbtZe0popu/0wenDSK0IpMlqcYVqcTOeXfWI3l MkdUtkLRBgod1xdZjfqVG+4DqZ7DzP+B2Rsal+vOI7CwCRhbE1opH7bV3pb/kgNH9/Lw v0sw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=o+vFfqqB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id om6si356167pjb.54.2022.01.24.12.31.12; Mon, 24 Jan 2022 12:31:24 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=o+vFfqqB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348579AbiAXThj (ORCPT + 99 others); Mon, 24 Jan 2022 14:37:39 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:59702 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345179AbiAXTcU (ORCPT ); Mon, 24 Jan 2022 14:32:20 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 34B69614A8; Mon, 24 Jan 2022 19:32:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0AC78C340E7; Mon, 24 Jan 2022 19:32:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052738; bh=k/Lz/Zo8RSedFrd/Cb57u0V3RMctMpavMVRb8b8/edc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=o+vFfqqBTfdJYK6XzOvdlqAYQFiNPXJx9Un/9tEIbhSbqOlDJOCFlUKGR/rsczmpP eU3xqZ9ugLwIMDI4JmRNom5kU0lvxtDnFd3HbkmXDSA24ghS0AaiKfZimr7FNMW3nU rZii2Ejine6TlSGPT8P8OiLEUlrnplIKqGdhc4o4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Wan Jiabing , Geert Uytterhoeven , Sasha Levin Subject: [PATCH 5.4 158/320] ARM: shmobile: rcar-gen2: Add missing of_node_put() Date: Mon, 24 Jan 2022 19:42:22 +0100 Message-Id: <20220124183959.009971247@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Wan Jiabing [ Upstream commit 85744f2d938c5f3cfc44cb6533c157469634da93 ] Fix following coccicheck warning: ./arch/arm/mach-shmobile/regulator-quirk-rcar-gen2.c:156:1-33: Function for_each_matching_node_and_match should have of_node_put() before break and goto. Early exits from for_each_matching_node_and_match() should decrement the node reference counter. Signed-off-by: Wan Jiabing Link: https://lore.kernel.org/r/20211018014503.7598-1-wanjiabing@vivo.com Signed-off-by: Geert Uytterhoeven Signed-off-by: Sasha Levin --- arch/arm/mach-shmobile/regulator-quirk-rcar-gen2.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/arch/arm/mach-shmobile/regulator-quirk-rcar-gen2.c b/arch/arm/mach-shmobile/regulator-quirk-rcar-gen2.c index ee949255ced3f..09ef73b99dd86 100644 --- a/arch/arm/mach-shmobile/regulator-quirk-rcar-gen2.c +++ b/arch/arm/mach-shmobile/regulator-quirk-rcar-gen2.c @@ -154,8 +154,10 @@ static int __init rcar_gen2_regulator_quirk(void) return -ENODEV; for_each_matching_node_and_match(np, rcar_gen2_quirk_match, &id) { - if (!of_device_is_available(np)) + if (!of_device_is_available(np)) { + of_node_put(np); break; + } ret = of_property_read_u32(np, "reg", &addr); if (ret) /* Skip invalid entry and continue */ @@ -164,6 +166,7 @@ static int __init rcar_gen2_regulator_quirk(void) quirk = kzalloc(sizeof(*quirk), GFP_KERNEL); if (!quirk) { ret = -ENOMEM; + of_node_put(np); goto err_mem; } -- 2.34.1