Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3694399pxb; Mon, 24 Jan 2022 15:34:27 -0800 (PST) X-Google-Smtp-Source: ABdhPJzItxUJyoExxEsADfZvXsPl0AK4mhqrdX7d21f8JFVrHtd8h+4ufB9L+ulJ1zE2tBbgSgmU X-Received: by 2002:a63:82c7:: with SMTP id w190mr2233034pgd.573.1643067267674; Mon, 24 Jan 2022 15:34:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643067267; cv=none; d=google.com; s=arc-20160816; b=kZiZSETYyIB1D07IvxUxOWNZbGSaZUQ6+41LaWnb4oZpPAoyrXKCoscl1rW86qkT5n KNZYUgpIBZdPD9d+Xkk3Y8w094HvHGqQDmgPjvtK1bT9WW7ssDKQiPNe6vmZDxtCvAAO bkpQNWVT4mz2FuDDM1p0CJZBmH/yVASF9uZiFWifiVRRsxRCZ1XW5GI43gXqcCHFlRDF FR5K5jgT3PanSB52FguNGar6DNIIbGzV8czLAxebNfI75A7WQOVOE4vmXG1I+rtVzEgo 0bxaNw/Mv6E70nEgbU3JDsniYiGDhWaNUTnD0AOO0PoOvJtLYApzPNoZkLbMGQ1n0N7c iWOA== 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=j0x5kCl9Qi040Es3xNNLC/lz3/mkdy/DeGSkWf746oI=; b=zpVwSasq+p8IplczlAEf9az8R4x/6DSsmDlA7wDi7BC0JZeCJuGpnyQSvY5ZShHteW woUtn685HTaTZxsvkKKFSvV6Hz+y7EaIvBJewo4a+7W25No8ENYCgjjno3B3Qud1SnHs CX0FmYCkqwZtanISQXswMGiwmveJd0VpP+qTmQmStr3yIlzNiqmD9Vu2WM5BZHgR53LQ YxWNOcf3qkMsiffnmQJ3tmaCkqwpQce9VZJvqYbjv21nDeOePuMw/ccuaB0A9mwd0+64 uMRsR7hczgDMdMcmQacXHeQ9pXMMWdlW4ILY+UWyjAI0LuIIdV2OZfH7sy/dUIDQxblJ DZzg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=imesMN+g; 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 j190si6329927pgd.501.2022.01.24.15.34.16; Mon, 24 Jan 2022 15:34:27 -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=imesMN+g; 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 S1850181AbiAXX1f (ORCPT + 99 others); Mon, 24 Jan 2022 18:27:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38990 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1588098AbiAXWbZ (ORCPT ); Mon, 24 Jan 2022 17:31:25 -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 1F572C061763; Mon, 24 Jan 2022 11:35:55 -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 BB2CEB810AF; Mon, 24 Jan 2022 19:35:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F0104C340E5; Mon, 24 Jan 2022 19:35:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052953; bh=TeOybPCuy899VcWCsri2XttiCdSsunaa++ru/kz8Neo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=imesMN+gxO+5qg3tp9fA/nqqu62q6LVX6WeTm6P3CMbGmM4R8b5dhJ5Fv3EE4EuFB UI5UcU/8umST89iLQcQYiCuXzghCKUs7YfsCgqdb9fhVK7CwC+SY9B4MQW4uqxjYgw gziwlWzxVJs+benjtbArd1FNYQYcg0FG8pGn0rfY= 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 227/320] powerpc/btext: add missing of_node_put Date: Mon, 24 Jan 2022 19:43:31 +0100 Message-Id: <20220124184001.709378667@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 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 6dfceaa820e42..b0e0b3cd91eec 100644 --- a/arch/powerpc/kernel/btext.c +++ b/arch/powerpc/kernel/btext.c @@ -250,8 +250,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