Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3558233pxb; Mon, 24 Jan 2022 12:11:07 -0800 (PST) X-Google-Smtp-Source: ABdhPJwCFXg492tTTXwjBu6jl4gWTRww4sywJ8MQYZtuhY2QaKDQTq11cy+bHswvrLVM5mliOIkL X-Received: by 2002:a17:90b:28d:: with SMTP id az13mr415pjb.7.1643055067505; Mon, 24 Jan 2022 12:11:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643055067; cv=none; d=google.com; s=arc-20160816; b=pgToYQex21HfDuMBMhy9h25is0nJjtd6N/lycpnVDn5hoOw95ifdvPboExcT5+WPo4 fjkfE9NGyaV5USeQxP6DCUE1jjJk6gRnVS8VAUg7Q2q3us6f0DUnAUONnotSf+TqgSGH UkVm2Tnz31nBxJLpzCC6hSOPLJO2CPsB4Udtn2TfQVDzyNep2xXLTRm/i2Ht3fb+i8YF 1EET8jLXoyAIkaQo96FNQemEqhrkUo+Ec6cmlweecW/Fo7pCz6Le4jSmdT1NRqmmWZYq gm5uJkJZYaL+1TfPz3TkbXWPwXxjTO0aTqClUWkPbk7QRs43cs/61pgIEparbNSgT0wv B7YQ== 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=P39p0w+TGPJaOWZhnCV2HElQvgbCDQf6sb4eGUfOLVE=; b=dRZ5aktsogjnTef7GKAHcwWDq+MBMU1zSgTPkigjWCCziz1XwYtik1bvtQmWTHD3Jd 5MMmS9gQKiM39v5EUrhv0vOZfrPRI43PwRdfeEZbNdBdQ793JM509Bpbd7et2/SsyVk8 1OTLwPQJ6BBf5u8XbsTAeHh9UBYwquqUaYUcgZl8RJ7wTsgJIX3DV/fz/vyOiYfA3bdu epM1jX1tRjj+erAA/b+i3Ltci3kZ9pxsewxuDaWGDwuNlq8jeRzk6XHW8u/9ipx/pVwA /KL6eF814kRLfLyPwsT7o2X/Q5mV+xYbxws5o4YIXYPwDqIKMmKSMoCW7fdHXkBYxpB+ ky1A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=WwUdcj1S; 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 f24si10798392pgg.792.2022.01.24.12.10.54; Mon, 24 Jan 2022 12:11:07 -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=WwUdcj1S; 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 S1344611AbiAXTNZ (ORCPT + 99 others); Mon, 24 Jan 2022 14:13:25 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46094 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346191AbiAXTFK (ORCPT ); Mon, 24 Jan 2022 14:05: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 F0DC4C08C5C0; Mon, 24 Jan 2022 10:59:40 -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 AF9E7B81215; Mon, 24 Jan 2022 18:59:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C79EFC340E7; Mon, 24 Jan 2022 18:59:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643050778; bh=n+OG6gPeo3Ix3CdWwgkqT9r920PvemF2ny3sKHTPWSk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WwUdcj1SCUKCCYP8DIdu5XwZLKM78EsbifiY+g6N7ZDSDYW4O1/mlr7y0S9z6SS8k ujP88jYxgEz7q++31Pw+n9ZNmpdVeCIYJTofVD63XjuoVcQAi9Wt4iAu1QMoTimSG+ 5Yc1gUENDH4acaftA+znb3xZxIH3QxFKkdyE5wlc= 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 108/157] powerpc/btext: add missing of_node_put Date: Mon, 24 Jan 2022 19:43:18 +0100 Message-Id: <20220124183936.198527817@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 a1d2b210ffa52d60acabbf7b6af3ef7e1e69cda0 ] for_each_node_by_type 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_node_by_type(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-6-git-send-email-Julia.Lawall@lip6.fr Signed-off-by: Sasha Levin --- arch/powerpc/kernel/btext.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/arch/powerpc/kernel/btext.c b/arch/powerpc/kernel/btext.c index 8275858a434d9..2d91ba38b4524 100644 --- a/arch/powerpc/kernel/btext.c +++ b/arch/powerpc/kernel/btext.c @@ -257,8 +257,10 @@ int __init btext_find_display(int allow_nonstdout) rc = btext_initialize(np); printk("result: %d\n", rc); } - if (rc == 0) + if (rc == 0) { + of_node_put(np); break; + } } return rc; } -- 2.34.1