Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3973646pxb; Tue, 25 Jan 2022 00:21:55 -0800 (PST) X-Google-Smtp-Source: ABdhPJzB1+Wpw8dhTxHvgpUjJBNVcrTUqvgO70huvMCtNWdkpfAdaUoDVVqKRGtLfEBSfaV5J1oR X-Received: by 2002:a17:907:6d1e:: with SMTP id sa30mr12412604ejc.526.1643098915705; Tue, 25 Jan 2022 00:21:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643098915; cv=none; d=google.com; s=arc-20160816; b=zRcz5b/TomwMYRQ19fqfbi0XBPnKrSXgOD165xS9F5MRLZXcxn0+t++T954YKqmajI /uBnaqeIwWRVc+t9ULA7nWbcjDrkGOlVfHrfLCANYSks4Hr5qNbqBHEr1OtiTgKcCDq8 bv880tiQ8PhMu5dGc+vTx0Mj3xyEKVbjUyz/ytMK0AfE9+4id2DP9IS+LeDNih+qJveE HLXnz+YLEJbTFIEBDG4aDjTrV6l7oNamSi0o4Mo/uAKjeZSVWt2nTu75/FyTbzQMlpDG 1z02YL5I2HH4PJcYqX1fpfk8XvOTm4VA3AwezrCOSAQkf0eXngAhnrCs6G4h6HdPDClN Q/yg== 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=9RXP+0M3vWDuG+lX5X2SfIdgTvv+d2V6zOxmd5rW82g=; b=C1juRkoaEwxx+odwMr8B5kAqUuEe5blMbTA1JRlbAF1gv4eikEn7FeGcwzaKETd9eF Yny+mXuzjO0ccd/V0GRvrXzCAWc99a0pb9J8mOnua/VHvcD0vSuKFCZ5gLdTO44g8cPI rhy0qLiZb5B0piBlKDJwliK14mb6C76KUBhj00U+z2tz/6DqrWPeoiixtYn6TmBdKjds axHhCnhTFrdeiVPqSidl3LCpR/Z0bq1z3EmkWPH25Kis7ZqU1l70JPYvrU6zPyLKqryh qKrHuRb1gpXdKPT8BvLWTcLspNkUisGmXRIKMxReVJRl56HYFEwoWsX+QxeL5sGbaMiF oc2g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=VjQQnW3k; 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 hv15si6214453ejc.585.2022.01.25.00.21.31; Tue, 25 Jan 2022 00:21:55 -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=VjQQnW3k; 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 S3420264AbiAYCXc (ORCPT + 99 others); Mon, 24 Jan 2022 21:23:32 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:35184 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346961AbiAXTJT (ORCPT ); Mon, 24 Jan 2022 14:09:19 -0500 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 7612AB8122F; Mon, 24 Jan 2022 19:09:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id ABBD7C340E5; Mon, 24 Jan 2022 19:09:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643051356; bh=31mIpIf4U5NaA21ma6Md0jO8Atfeo/xK83c8MkT/dOc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VjQQnW3kiUNo9ojGRqkRA5y2U0W7zTtCrxb4KiJ409afuTMBFrYxv5S1YazaxzRHh d59LaJpTWIkauJYH0rBwZ9PRsDauQ5/gTTSSP70kzEtMwyXnfOaJTfe+cQDI13l5os b42SuwpRn7vGx/twWERbgv6b9zmNQXfZGl+DHC40= 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.14 135/186] powerpc/btext: add missing of_node_put Date: Mon, 24 Jan 2022 19:43:30 +0100 Message-Id: <20220124183941.452996642@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183937.101330125@linuxfoundation.org> References: <20220124183937.101330125@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 6537cba1a7580..d1a2fc7186ce7 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