Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3558216pxb; Mon, 24 Jan 2022 12:11:06 -0800 (PST) X-Google-Smtp-Source: ABdhPJxRKayFLLdwJtnWaLGGuulKzsP52VCSe7P/JclNh6c47scHGnD/V9gxl8HRjpKwEh3bHz0+ X-Received: by 2002:a17:903:11d1:b0:149:57d1:acc6 with SMTP id q17-20020a17090311d100b0014957d1acc6mr15526795plh.134.1643055066308; Mon, 24 Jan 2022 12:11:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643055066; cv=none; d=google.com; s=arc-20160816; b=gsJniELJxHjzS6KtwZZ+HvfcsnqNQtp+IYpyN8zA6xAY27uWgolCFNiVZwp9/40MQd 7VkOcOJluOnQd98Kb6erRxnv9NPo442egBnm3oTirYQ4yMIzqiPeBS36cLq2nf8q+vVe nk6e0166moS4hY4QsBbXemCqkB9B3dya5/SKQ0Vyj/15rFJIS6Ldj4WBkMRjhCO3etem djSA/H1xbATMWODs+aOyeHS0amQbskoRnLavYWqZho2aXqVHA01AAe1t7QwsK1GlvGmr JWCVSb+hfaJ1IYpOtvPM1P/NbFLCUSYYmmYY+UTaoLpYUgoD0CfaCYwdBghUEIFFYhC7 YQ/g== 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=Kya/xO/RpNKklGdABIg7PTrAKznuZi9pmtrPq+e3lcI=; b=BZu1/UtWRD7DRFHduD8zCfu4hRwtEVF24jOB5Rk3T5mwoO24n3WvU6OSs1IjRlhXdM B1w8udcs45jXQocQytnE+UyOtO3CuMiy5qUspDt55NKsz8lf3RGzuyTc4ZfvsX+cxD4k Y7adpPlymI/73NY6LiASq+9PQTEkXKryLrwVu6iZkSzoBhLhSK++R2wTOGyRQn82gOWG vbGsePAQIOTeJ6ZnPsfL6fEn6N6iHK3BUhdPyubJLHskulUSnvaHKQuzChXYAiWn0xlz 6rH1kEIlXESn4+/xY+kYOg4UK3Dtba0KtexhhT1wXvZ9VRjDZ2agiBxyYywS9RkBmzPs Hmuw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=yrdujnL5; 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 x7si11038750pgb.237.2022.01.24.12.10.54; Mon, 24 Jan 2022 12:11:06 -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=yrdujnL5; 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 S1345873AbiAXTNe (ORCPT + 99 others); Mon, 24 Jan 2022 14:13:34 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46074 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346179AbiAXTFJ (ORCPT ); Mon, 24 Jan 2022 14:05:09 -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 7F48DC0401FA; Mon, 24 Jan 2022 10:59:34 -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 495F6B81236; Mon, 24 Jan 2022 18:59:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7511CC340EA; Mon, 24 Jan 2022 18:59:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643050772; bh=nRljK2iWbb10p4w6RFd1lQ40Hofhpav2Nn+BCIRYQ08=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yrdujnL5g8LcruFa6Euut5oINMfQgOoiCk2e+zLYAL0y7ArGK6iWDqwn6NLOggbYP CJD3cU6q1PUsk5rvRamJJPOSwDTkKI/tm9wqNVHUmf+8XIo6c0ILudAjx9Yn+jEp4g neRizVS0+ySoI0zH/i2rG2aXzggoxOhIaePw5BtM= 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 4.9 106/157] powerpc/powernv: add missing of_node_put Date: Mon, 24 Jan 2022 19:43:16 +0100 Message-Id: <20220124183936.133978740@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183932.787526760@linuxfoundation.org> References: <20220124183932.787526760@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 e4169d68cb328..d28c4a9269c38 100644 --- a/arch/powerpc/platforms/powernv/opal-lpc.c +++ b/arch/powerpc/platforms/powernv/opal-lpc.c @@ -401,6 +401,7 @@ void 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