Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3583841pxb; Mon, 24 Jan 2022 12:49:21 -0800 (PST) X-Google-Smtp-Source: ABdhPJz0Thjx1h0mBkWtsnoIemYkFg6fDQKPC6PRfVMKmtyKMI4Zt0jVHqFRWY3AP8sX6ZfdJT/D X-Received: by 2002:a17:90b:3144:: with SMTP id ip4mr71694pjb.23.1643057361346; Mon, 24 Jan 2022 12:49:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643057361; cv=none; d=google.com; s=arc-20160816; b=berZ3u/HKYe6C8nGFiuoC8/lGl2NbpzIYkr0+tOx/SJQ9H4bX9EIzLUOt5rPsrIlTZ WmgbBlELgMcY/j3Mbnji+Hv6tGZVBvPyf6ezsnJaa2l3lF8Hi5tLT614vKT2THwOp029 /PDGNuacugaBtyWP3yRrIVMBqc7JpSxqEY87EUpPfDGc4tBGHwhawN/OLs5cncsQjaq7 njb2vDXQVTz5b5pukCgQprgQLgNsT/yHsB1aR+ipq4iEfHO+zmldsfF3+SADQztOwpj2 Hij05k3Aq41PuzK0Q2QQNh62E+meQMri3HxHyy+pR33WWLwCgn73PygIuhAvzUmvl1da 0zgA== 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=1sigYy45EH574jgrkiOIXzpC8Hz+gsiCKC8TZfPm20k=; b=BEfTDj/tU69EknU1mW41ZS+TaKNolvghbpZjUUhzX+LlbBdMvYEbh5BLNWeCPrOALw NxwljEDe6UeTgQhnvmW8DI6bwwOgmCKnDsuifrZU7KpclBh/F4QVBAtN17O1W5TYaGuL UpXlvyWE9WU+62TICpVD++VaAyT4GJi8IEL7i7X7F7eMqNhnyeAyHnb9to075qhb7V5U BUC15DlKpuS6IC1bXI1mSVlDUsd5m1BhMPUs9aEPqa/H+8Duo8mr9cWrKrB2NrU5HWUi fTKRblXvU1t3vyRWH1I+ra/gHi301SVtNxVooiJD2tYlQs574UGXOm3/R4Nl8e9YEM8u sm/g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=00RuObrD; 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 s5si14823601pfk.321.2022.01.24.12.49.09; Mon, 24 Jan 2022 12:49:21 -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=00RuObrD; 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 S1377122AbiAXUE7 (ORCPT + 99 others); Mon, 24 Jan 2022 15:04:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56220 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1356721AbiAXTrE (ORCPT ); Mon, 24 Jan 2022 14:47:04 -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 03CC2C061781; Mon, 24 Jan 2022 11:23:00 -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 94BAC60909; Mon, 24 Jan 2022 19:22:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 57D64C340E5; Mon, 24 Jan 2022 19:22:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052179; bh=lonuAKS53DUKY+ol5S4xBe1LsE3sXOcVFIl4cO81vTE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=00RuObrDchfJM1rjRyNhOr0TkF04o4IGlMIAXyjX1/nLXVLMxSAFAuEOl+ghA2fNr henCf2sqgITzT5Cyl2n1n+KVICaLzZYc1OSNAo/lctzCqVY67dbNFTPHh3Y9DQdnKx /4ZNZCZFgkAR2x29yka2Ja/q4DjGjJ/R3dJHZkNM= 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.19 181/239] powerpc/btext: add missing of_node_put Date: Mon, 24 Jan 2022 19:43:39 +0100 Message-Id: <20220124183948.851048779@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183943.102762895@linuxfoundation.org> References: <20220124183943.102762895@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 b2072d5bbf2bb..a046504d8bfaf 100644 --- a/arch/powerpc/kernel/btext.c +++ b/arch/powerpc/kernel/btext.c @@ -258,8 +258,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