From patchwork Fri May 28 11:50:35 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 12286843 X-Patchwork-Delegate: daniel.lezcano@linaro.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 70866C47087 for ; Fri, 28 May 2021 11:51:24 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 449CB60FDA for ; Fri, 28 May 2021 11:51:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235730AbhE1Lw4 (ORCPT ); Fri, 28 May 2021 07:52:56 -0400 Received: from youngberry.canonical.com ([91.189.89.112]:41007 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233429AbhE1Lwz (ORCPT ); Fri, 28 May 2021 07:52:55 -0400 Received: from mail-ua1-f70.google.com ([209.85.222.70]) by youngberry.canonical.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.93) (envelope-from ) id 1lmb1L-0003yy-0I for linux-pm@vger.kernel.org; Fri, 28 May 2021 11:51:19 +0000 Received: by mail-ua1-f70.google.com with SMTP id z43-20020a9f372e0000b029020dcb32d820so1804114uad.2 for ; Fri, 28 May 2021 04:51:18 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=wxELusyIBpP+fcpz/UatIhkxqx6ZEHw/DrcqLu/q/aE=; b=lguwOczczSbMdYLvrtPcnJLR5M1OYvwYMtAZ+EgRzFPP0CyJgI1CsmOgsGi/9quI5N CKit82YYNJcmKmLNK3X4Qf1OE3wjVdxR01LCCRd5I6U9NJb6vThrIN5ZNNMbAChsSStC jG4KzqxS9gTm65e8wTCaX81P0r5YdnGFivsVHj3zDGHEDz7MnA1cCH+6gCwpsGBBgZoF 1hkH8wqlyEQtty6An1MNKz4C2wN2qMQjMI2O9P/hGQ1uzovlFDhHluNyRkLW7bRBBXB4 z/ArAYG3U9Zuy5k0yt3qHJ03wRlbFvVct5pVtE2lYojebrN98fVb/zw+UDQHOh9pv5r7 VzTA== X-Gm-Message-State: AOAM530EC0JBqGND4rnHQcyAjJIo5b9n9N9PGeg1SYZX1mAGDMZlGE4A Uku/JukcUDCnSBz6gi2Q1Zh2df6Sj63uaLRpH+rfJ+ZiGc2PpfuqBFv4riDsDYeQEGMvfhr1A38 Yz0rJjKYhZNcynP/IkwKoc0YlYJLzKxDuN7ef X-Received: by 2002:a05:6102:31b7:: with SMTP id d23mr6244278vsh.56.1622202678192; Fri, 28 May 2021 04:51:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwHV9HC0ax8TsVv9E9U2CrKXRWFKJ3kwO0G5xeZeFJCvWLuvkFRNODMIQwC/X1QAj1earJCHQ== X-Received: by 2002:a05:6102:31b7:: with SMTP id d23mr6244268vsh.56.1622202677969; Fri, 28 May 2021 04:51:17 -0700 (PDT) Received: from localhost.localdomain ([45.237.48.5]) by smtp.gmail.com with ESMTPSA id 189sm669831vkz.51.2021.05.28.04.51.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 May 2021 04:51:17 -0700 (PDT) From: Krzysztof Kozlowski To: Zhang Rui , Daniel Lezcano , Amit Kucheria , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Orson Zhai , Baolin Wang , Chunyan Zhang , linux-pm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Krzysztof Kozlowski , Jacky Bai Subject: [RESEND PATCH 1/2] thermal: imx_sc: add missing of_node_put for loop iteration Date: Fri, 28 May 2021 07:50:35 -0400 Message-Id: <20210528115036.18222-1-krzysztof.kozlowski@canonical.com> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org Early exits from for_each_available_child_of_node() should decrement the node reference counter. Reported by Coccinelle: drivers/thermal/imx_sc_thermal.c:93:1-33: WARNING: Function "for_each_available_child_of_node" should have of_node_put() before return around line 97. Signed-off-by: Krzysztof Kozlowski Reviewed-by: Jacky Bai --- drivers/thermal/imx_sc_thermal.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/thermal/imx_sc_thermal.c b/drivers/thermal/imx_sc_thermal.c index b01d28eca7ee..8d76dbfde6a9 100644 --- a/drivers/thermal/imx_sc_thermal.c +++ b/drivers/thermal/imx_sc_thermal.c @@ -93,6 +93,7 @@ static int imx_sc_thermal_probe(struct platform_device *pdev) for_each_available_child_of_node(np, child) { sensor = devm_kzalloc(&pdev->dev, sizeof(*sensor), GFP_KERNEL); if (!sensor) { + of_node_put(child); of_node_put(sensor_np); return -ENOMEM; } @@ -104,6 +105,7 @@ static int imx_sc_thermal_probe(struct platform_device *pdev) dev_err(&pdev->dev, "failed to get valid sensor resource id: %d\n", ret); + of_node_put(child); break; } @@ -114,6 +116,7 @@ static int imx_sc_thermal_probe(struct platform_device *pdev) if (IS_ERR(sensor->tzd)) { dev_err(&pdev->dev, "failed to register thermal zone\n"); ret = PTR_ERR(sensor->tzd); + of_node_put(child); break; }