Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3596466pxb; Mon, 24 Jan 2022 13:07:54 -0800 (PST) X-Google-Smtp-Source: ABdhPJxtQGKlzS24UEV8/Op/vJFNpuAoyI2EzfdyobPbEgg4+zIGPnm5nkxUdbNXX4Senyd3+t+r X-Received: by 2002:a17:902:6b81:b0:149:7e13:6d4e with SMTP id p1-20020a1709026b8100b001497e136d4emr15992504plk.47.1643058474559; Mon, 24 Jan 2022 13:07:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643058474; cv=none; d=google.com; s=arc-20160816; b=JmI81r2Z5ojzSTH92Gbm/F9QaGDndhrn3sJ+ptlk+NCb7PAQVysDCNH93QvMrUOhXj Rx+24hJNXBuq/qbe243QgiPSw4iQAZ2ZZTmWrGS/STag0JRV2a9ZhmKS1Ejga10V3jVt 0nCx5AJEYRkyllUGPpsQlZ1iOQK1H8w0lq4bkH94srWNxwxM6GJx4AbTHTSmW9jdpgov 9tcqS6vtl+Sh0nnncy9btm5XUfLb6kMeeajVr2TByvwCEaoO8OFO6w18XmchCvM20PPK fmhB7Zcl+gwBIKOtB8zaCCTjcRIWTTYFKeLNMzRW+pXGDMfOo26gUaigu15LDYUBriDR DZHg== 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=TSJlcqrQDmvTExE08yc3xFB+mbx+b6/KUeFc0BnjWnc=; b=WYvgdDCSXPoTYJCLr/OdJ+EF1tUcxa7z8WxIoE0qR/EugIWTMlVG1Jbv0xyJEm/d2f taf1AoDE0s2RXZQXl98IGX/iFzsq8g7MY1M7NaINi8GZvH0Ke4wIDQ5Ofg21IXLo7W/T q8U7YwQ/eu1g+GwDG+6pthWT21GFwEVCCpr8ngMA8XCHxO+h6Zy37HaFPyJJzBlXdRaD lQ0JksB8Tud3MTQoqoIx+7++Uo1fcGRarn8CoJec2kUirAFa7D6h9JoiyLUb7/Iy1pg6 jeng3UM0Wz/xBRJKLaslo1Plp6pZgYny2CS5oNCujk3FVjrZ8XmFZ6Aq2QS+qW218wUB b+Bg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ss65pz7g; 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 b7si13422421pff.301.2022.01.24.13.07.40; Mon, 24 Jan 2022 13:07:54 -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=ss65pz7g; 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 S1345784AbiAXUcr (ORCPT + 99 others); Mon, 24 Jan 2022 15:32:47 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33856 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352212AbiAXUNi (ORCPT ); Mon, 24 Jan 2022 15:13:38 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7F5C2C061760; Mon, 24 Jan 2022 11:35:48 -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 dfw.source.kernel.org (Postfix) with ESMTPS id 1EC70614FC; Mon, 24 Jan 2022 19:35:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EF66CC340E5; Mon, 24 Jan 2022 19:35:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052947; bh=KUsfQVHU2x96z/Fe4VrNN/7LI2bKQv8NRmV2m8PqQuE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ss65pz7gvH0Kl51OtAOYXOuoY3JbN58w7KmC7orChKCDBxFG6Rbq1FMwid9Ku5X5S gMYEQqvoLJIAbqsOaryt0WdLj9QqCMhBKVCE0O0nkczcsnedEf6tKfxE58jnXAP8lR SG0UUGGY7TVFHl0mwbvE46bkUom5/6hoeP7PadLA= 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.4 225/320] powerpc/powernv: add missing of_node_put Date: Mon, 24 Jan 2022 19:43:29 +0100 Message-Id: <20220124184001.645205945@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: 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 608569082ba0b..123a0e799b7bd 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