Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3675481pxb; Mon, 24 Jan 2022 15:05:09 -0800 (PST) X-Google-Smtp-Source: ABdhPJwC6tSIHGuCe4cyPaRr4z7TlOfJPy0OhnPa0iKCt6Y7Qbbi813y31UZDhsXuQb5SRcXNDGp X-Received: by 2002:a17:903:124e:b0:149:aafd:494c with SMTP id u14-20020a170903124e00b00149aafd494cmr16588059plh.164.1643065509043; Mon, 24 Jan 2022 15:05:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643065509; cv=none; d=google.com; s=arc-20160816; b=PWfpvNzdSprlKuVVkkZk4X1IC0Xk4nGsv6kj1HPjgniNnLwSXH1tEHEHYihEzJvrgN XT6/uJNpeGKl80mVf2UHy9RdquMM4TFy61adQ/nrKZGGY4FTFgReoPkTfzDkRO8H3GG0 Xqk7uK4pygXpVlp9xUyyCKKzAphRbDcR04Iu9jxJbSd1OjLUNf5IuE4Oc1vgm5NFa5Q3 3ahnqqsDVNk/TkYDBOXLHHdlQs4fEl4sOt/F5iICONXZAPxmhaF6vG2fTOrz0CrOm77D 2Q2pn06MVKhUeV2qbDqXvRSizLHUkR+qLwiy0a0tK4pu7WZKL3Mzc+I9sCFeTPt/3pmB /sIg== 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=cTZh3dLC6k2Vzm0otUn7jN1QOn0jqBpAfkYs4nOaJsqVjW2oPqgEaXKma8copvhOrR yBuRZuBcZfSZ/KNKgSIOjwHvVtecn082/xSxwHfxo7uhp00lNzpy/DKFNyJ6UzgtKrul AVMBQNJXMQBEzTPrvyAvCzGEeLQuNR7A1YgrxKohMfUjsRKVsINTau78GUQ0KlyH/D+p QsgT6yRSycWUEi98PrqPYJV5z9O8L9EU+jxXvABs85Q7PdbPSENjfoWodqX8qof329pD vQxW+AMQn/FHFa4nYG1W3V4ZFtQ6N7w4EM9LwgQTO0lVhUy3SIpOjMfpYThWX59dMAvT OoMw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=f75i9pCO; 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 d1si539693pjr.110.2022.01.24.15.04.56; Mon, 24 Jan 2022 15:05:09 -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=f75i9pCO; 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 S1842270AbiAXXB1 (ORCPT + 99 others); Mon, 24 Jan 2022 18:01:27 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60040 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1577829AbiAXWBK (ORCPT ); Mon, 24 Jan 2022 17:01:10 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A20AAC02B848; Mon, 24 Jan 2022 12:41:01 -0800 (PST) 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 5D97CB81061; Mon, 24 Jan 2022 20:41:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F0029C340E5; Mon, 24 Jan 2022 20:40:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643056859; bh=rfnii2i5sU04+NW982sp8A0gGiDGgjs8gxUSp7gBgk8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=f75i9pCOYfDibsa7EEOUK5mgHht+cl2z6+rt0sj1T5Fm5nLjgNcWYrFWbVzVCY5lQ 9vF+hqaio1rhTAWedMM40K99RQeGXyydx8YyQbsyk8503TIbVw/fgkWNi64Oh6zKlH xsh54Px0+cGKttA6LUUaN722OSTnRCknNzMKyPow= 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.15 624/846] powerpc/powernv: add missing of_node_put Date: Mon, 24 Jan 2022 19:42:21 +0100 Message-Id: <20220124184122.568589864@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184100.867127425@linuxfoundation.org> References: <20220124184100.867127425@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