From patchwork Thu Sep 7 09:55:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julia Lawall X-Patchwork-Id: 13376327 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 660B3EE14DB for ; Thu, 7 Sep 2023 09:56:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=yBbTSfFu4LKVghpmi6xcGN7kumHBUFvTdsHhkfX/m6k=; b=AAjcBlaVVYTs3l 1JmJ1dezXoLS98mCiuup9OQLquk5DGQMCMWjhz5lpr0RfyXXXEo47MKh6nkfgY/P8aM3t8RgezVwz HaxwZzxnEYPRZt4pS7QQR2Yh9vk07ArOwjxElKCizFgiHv9o509CSfCoUgXS75NdHBTmeLI0ydILZ i16STHH+R+KAbyiBZa8aeVghhXrb5LeDB/lZ4vBEh4JngrKcmsqK+to2A9SkcvO55mDQ7kXEp+djr Ad/Lud7mNQBXfwGZ2xihIRaz1yyzUDK2tHX3YVW9e7PGsXLtU4ZlC7sZLfYz9C5Yx4HBTT18gzM2i ypSrD9i68ovIWm9QQKbw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qeBji-00Bj7S-2i; Thu, 07 Sep 2023 09:55:42 +0000 Received: from mail3-relais-sop.national.inria.fr ([192.134.164.104]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qeBjg-00Bj4d-06 for linux-arm-kernel@lists.infradead.org; Thu, 07 Sep 2023 09:55:41 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=inria.fr; s=dc; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=yaKS76r33jDdN4YRfQ9rWXkWuhK5u7HSRxlycGPVIFs=; b=btpK9sTraVPQp9hlYQYmLOZYuH4BemJfQO3Y6HfD7eMk6iciEM3G6gVp gj/DRuzgUayvoqqq1TEMEU1F88NNsRqJhwhhrETcRNKUTBsvLlgnP+2wx lmxSMbY4fUz+f98xZQTgpmAFpRGIQkc0iRe7rlU3MfCQyhTCBe4QtKCPv g=; Authentication-Results: mail3-relais-sop.national.inria.fr; dkim=none (message not signed) header.i=none; spf=SoftFail smtp.mailfrom=Julia.Lawall@inria.fr; dmarc=fail (p=none dis=none) d=inria.fr X-IronPort-AV: E=Sophos;i="6.02,234,1688421600"; d="scan'208";a="65324659" Received: from i80.paris.inria.fr (HELO i80.paris.inria.fr.) ([128.93.90.48]) by mail3-relais-sop.national.inria.fr with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Sep 2023 11:55:30 +0200 From: Julia Lawall To: Nishanth Menon Cc: kernel-janitors@vger.kernel.org, Tero Kristo , Santosh Shilimkar , Ulf Hansson , linux-arm-kernel@lists.infradead.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 04/11] genpd: ti: add missing of_node_put Date: Thu, 7 Sep 2023 11:55:14 +0200 Message-Id: <20230907095521.14053-5-Julia.Lawall@inria.fr> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20230907095521.14053-1-Julia.Lawall@inria.fr> References: <20230907095521.14053-1-Julia.Lawall@inria.fr> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230907_025540_371614_A1F3B1C3 X-CRM114-Status: GOOD ( 10.47 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org for_each_node_with_property performs an of_node_get on each iteration, so a break out of the loop requires an of_node_put. This was done using the Coccinelle semantic patch iterators/for_each_child.cocci Signed-off-by: Julia Lawall --- drivers/genpd/ti/ti_sci_pm_domains.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff -u -p a/drivers/genpd/ti/ti_sci_pm_domains.c b/drivers/genpd/ti/ti_sci_pm_domains.c --- a/drivers/genpd/ti/ti_sci_pm_domains.c +++ b/drivers/genpd/ti/ti_sci_pm_domains.c @@ -153,14 +153,18 @@ static int ti_sci_pm_domain_probe(struct max_id = args.args[0]; pd = devm_kzalloc(dev, sizeof(*pd), GFP_KERNEL); - if (!pd) + if (!pd) { + of_node_put(np); return -ENOMEM; + } pd->pd.name = devm_kasprintf(dev, GFP_KERNEL, "pd:%d", args.args[0]); - if (!pd->pd.name) + if (!pd->pd.name) { + of_node_put(np); return -ENOMEM; + } pd->pd.power_off = ti_sci_pd_power_off; pd->pd.power_on = ti_sci_pd_power_on;