Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3648701pxb; Mon, 24 Jan 2022 14:23:31 -0800 (PST) X-Google-Smtp-Source: ABdhPJxMZoTTBeiPGa2LaqUjio9i9WfB/Lzpi1SIFui+mwFxxiFqKmFvUUWBEM+VldT8ItIrDWFJ X-Received: by 2002:a05:6a00:24c2:b0:4bc:bea:1e60 with SMTP id d2-20020a056a0024c200b004bc0bea1e60mr15656907pfv.63.1643063011295; Mon, 24 Jan 2022 14:23:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643063011; cv=none; d=google.com; s=arc-20160816; b=FKKdoTAkQTxe6hbbnGciIZzUSvIF4i7dQ7zVi4lsm69cB+Tn/dlk+hGui+T9FkXIl4 gt4g6j725jOd1m3MVWsjpAXz1EuNPa4JMOfPHA1GjFh8Ev/LJ/Mpaerft21JQG+0YdxY KQKQpwHqHDC/ylK6ekyNIud4bcovHfcpYDMnFdC4w5q+rQ8n6DG/X+XdN0997+ifSFSz 6L0jjz9HJxykhVBTS+4owHOc3BmBEB/0zvbzHKMTpzjo9whrWzyCPNoP9nEtmbu01gOb wzrN8FGNswcWinOy+6AJ9Hmvd6Qmf4NX/3Kw1hgASKW7qecIcc8pIO2TSwX5QxJyA6uD KEiA== 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=jx1X1JRv/4+jFnnXw9cL3lGbVTdXVVLuyYKvKuHnZTk=; b=m1YJlkIZW7PNOhj+J9Xw90YEPanO338ADgI/r5RQ5D58q5y5cFNrmd9tIaWnqZDW4q UzR7to7G2ae1Z6jH0oxvYSSpKw1FTm+x7/1zQx3DlWk8Etfbi8KynUjmNGcmcpJNs/Mo ZXmLQy1c/tze7eKJ4yRp+IK2R1oBu/Zc1GdsKxQL52CASh8K6E3t7qJa1wGHjBNxYQdT SMjasNc+Yl5l2LQEWMgc2VW3SByO/2tN8qn40QSa40y+J0O1l9IqbiOeoQwGMDep4v5j Jdid6RoWc6pX151r/uHTJtrmms7ZNZQE3kYVXFlYV04ieKlBDuiQkgT05yyn9ux0mZ0G BecQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=tspMyoxb; 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 z4si13994936pge.854.2022.01.24.14.23.19; Mon, 24 Jan 2022 14:23:31 -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=tspMyoxb; 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 S1581980AbiAXWMr (ORCPT + 99 others); Mon, 24 Jan 2022 17:12:47 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:44874 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1453305AbiAXV3w (ORCPT ); Mon, 24 Jan 2022 16:29:52 -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 ams.source.kernel.org (Postfix) with ESMTPS id ABBEEB80CCF; Mon, 24 Jan 2022 21:29:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D1F57C340E4; Mon, 24 Jan 2022 21:29:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059789; bh=rfnii2i5sU04+NW982sp8A0gGiDGgjs8gxUSp7gBgk8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tspMyoxbP3SCoSwMWHso/bDM9Ue/QNlyhNeLrTyPOMo16R7tstHFHsVm0c9Nyb0WE QvXRpVlFlqXmH0D8Mipz+kA0OTmjly6BxSXx4iHDdTQ1M34RE6ys2rpIG50+RxTpXR TSRjt2XYsFoflKRjVsGWc5yD8axwtjGf6qxNj1fU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Julia Lawall , Michael Ellerman , Sasha Levin Subject: [PATCH 5.16 0735/1039] powerpc/powernv: add missing of_node_put Date: Mon, 24 Jan 2022 19:42:04 +0100 Message-Id: <20220124184150.030797507@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@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: Julia Lawall [ Upstream commit 7d405a939ca960162eb30c1475759cb2fdf38f8c ] for_each_compatible_node performs an of_node_get on each iteration, so a break out of the loop requires an of_node_put. A simplified version of the semantic patch that fixes this problem is as follows (http://coccinelle.lip6.fr): // @@ local idexpression n; expression e; @@ for_each_compatible_node(n,...) { ... ( of_node_put(n); | e = n | + of_node_put(n); ? break; ) ... } ... when != n // Signed-off-by: Julia Lawall Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/1448051604-25256-4-git-send-email-Julia.Lawall@lip6.fr Signed-off-by: Sasha Levin --- arch/powerpc/platforms/powernv/opal-lpc.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/powerpc/platforms/powernv/opal-lpc.c b/arch/powerpc/platforms/powernv/opal-lpc.c index 1e5d51db40f84..5390c888db162 100644 --- a/arch/powerpc/platforms/powernv/opal-lpc.c +++ b/arch/powerpc/platforms/powernv/opal-lpc.c @@ -396,6 +396,7 @@ void __init opal_lpc_init(void) if (!of_get_property(np, "primary", NULL)) continue; opal_lpc_chip_id = of_get_ibm_chip_id(np); + of_node_put(np); break; } if (opal_lpc_chip_id < 0) -- 2.34.1