Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3678772pxb; Mon, 24 Jan 2022 15:09:04 -0800 (PST) X-Google-Smtp-Source: ABdhPJzsg+zdIlnyTDUrf2FK8HdvSpUkULfLt/6VLOFaLamAIvu6JFF6XwlB6ynhuEPsMghZrgfd X-Received: by 2002:a17:902:b110:b0:14a:197:dfea with SMTP id q16-20020a170902b11000b0014a0197dfeamr15880100plr.142.1643065661513; Mon, 24 Jan 2022 15:07:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643065661; cv=none; d=google.com; s=arc-20160816; b=vfZjy2M2fyb0ggT5xtke23sScXyLVkhcUn45bZjE7uaytwg8It/o1xm8M4yG314ceH iO0Rzhvm15Z7FFp6R5oLLLMqCk0v4ZxVGabPANDdB8ONgCKGKnoIEMI8EQAmZzXdnZXl CaR/nQ6oZGsnQJy85gnqRASNXqCmqKdGc+QpraHJLB9+8bGuar9oDJe8DnimBWKmZzRo gfLHggJGbxcNU2LPJ5oOvyyB4DVSPGloDzVlyBS7SO98qY8G9xzfgTqsLilDmaDDTcGY kPmByw334KACFjp305cINzZdvCZzvEn3QZbkgAzMLohbof8XhLL8uV7e4XDPOSCe/8oc HKWw== 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=l5PPQcl/DMcJjeWZyeKB8ahX55T1JEqIjDRLx6BpqXM=; b=0RAXbCY1t4GLM6NfAMIW48xZZxYQgHAPboIi2KwZEVxl+Sz4wwWWkP8Qa4kWXFuBvH YGzAKFVYF2uT2Tgni3+hB05cd8aLzR/fZmn/j4xuB6cc555/XsDqAY12jko4jgkzsuNe +xbSc0ZU7trARZOQN335YvidT2rBgn545EFj5gpUbGbf0wcEmDlft/HXVBEuDV09ArPr NxixHWRwJLqxdvgg50DGY1nYfZU1PdPNS8nitwt5t1aCkC7GlCwygWcrLGIkqS00m/q8 SmBP33hBnskaOvFONrdWYDbFSYNnSllYqzWO4CJkxS/Cf1hD4lwxgX6k0XAJc3LJPBtR dg3Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=rpzgN1I8; 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 n68si14828179pga.305.2022.01.24.15.07.29; Mon, 24 Jan 2022 15:07:41 -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=rpzgN1I8; 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 S1843181AbiAXXD3 (ORCPT + 99 others); Mon, 24 Jan 2022 18:03:29 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60034 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1577873AbiAXWBL (ORCPT ); Mon, 24 Jan 2022 17:01:11 -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 0BAA8C024150; Mon, 24 Jan 2022 12:41:07 -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 A476BB8105C; Mon, 24 Jan 2022 20:41:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CA6A4C340E5; Mon, 24 Jan 2022 20:41:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643056865; bh=noPkjLggVRzhHtJtUyyY8AiSqQGvqU0JZkwRb0GYV3U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rpzgN1I8k+DJlBzQYaWTUsM2x7OxqyVd5fhcKp4q0UwxwPZ+lTaen4u1Ej7xbsqGE WRsg9pVDQ54zr8Qq6TwtyWq7uI9jjUT82HAP5FSK+le+KRh6bJ4yRMX8JkWQJtOmvv Suw7ADGPwGjKgV5C7G1o5C7+J3TOgnFf0nSH9Mh8= 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.15 626/846] powerpc/btext: add missing of_node_put Date: Mon, 24 Jan 2022 19:42:23 +0100 Message-Id: <20220124184122.631542189@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184100.867127425@linuxfoundation.org> References: <20220124184100.867127425@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 803c2a45b22ac..1cffb5e7c38d6 100644 --- a/arch/powerpc/kernel/btext.c +++ b/arch/powerpc/kernel/btext.c @@ -241,8 +241,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