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: 12286871 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=-17.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,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 2C85CC4708C for ; Fri, 28 May 2021 12:08:28 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id DD446611BD for ; Fri, 28 May 2021 12:08:27 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DD446611BD Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=canonical.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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: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:In-Reply-To:References: List-Owner; bh=wJQ6tvZ01rpg/I5HviIja0ZHiGhEAD/gn4ZfE+1hnwg=; b=M61eTgm+hIfETL HI0/z5IyTw45Y5LR4K1XztguLAqjUXVpoBZ8Ajo1YDRdbadaZZFnLyI8rL6KLAVxYy/98vJT5MSCf ABQ0j1eDxVS6OEIfLtoXlWi1Ph9HrDUcR+Y+1XvaVIpA/kJiwdZ5aSnU154f5JfZwrS75bHMhhCoX YIXCM1tBN071fpcERw48mxMw45oN5n1eB/GqDl/T6oxEKiVxvKLHS2E4q67wXNbEUPOLQH+zMGQ11 7lfA++d1xWE3/A1Q7PTB3uVgd77IoZj41N6Y2rxVKGQvzSTKZf2a3ATO2yqxHAUHS3TZrZwcMgYRO /+EfFeeix1tKtApAbUgA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1lmbFw-00FCb1-0j; Fri, 28 May 2021 12:06:25 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1lmb1O-00F5Sk-Dc for linux-arm-kernel@lists.infradead.org; Fri, 28 May 2021 11:51:23 +0000 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-0003z3-1D for linux-arm-kernel@lists.infradead.org; Fri, 28 May 2021 11:51:19 +0000 Received: by mail-ua1-f70.google.com with SMTP id j23-20020ab01d170000b029023ea6f67624so1593329uak.14 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=M8CQx22cVOBsTqNG50aSn/dzM5TJfoqkYFYuEoixScLUD3ORewAYclqmIF7L5K7BYf NxrjGdNc42tRYqzNQ5FjJTj0R+yuHDN/IrltWovLwQ8J8mJD/U81N290DDxl8eqMyS0Y gmQqoR4jYDE0fE7qjrO+jy150k+0qeqw4JlR+44BnEIotQJZ0W1iMEVlVe46tyCWcL/P SR2/xsvX1hieeK+zS4uT+Rwn7W46SIGPNMVq/bOKUBS1osoTKcXSaKcwsjrWvyaGPIP/ vJVEdAgQ4Q+JFwa/W9/bqKxmp/TWVmX6M3OsgC/THGqKdQb5y5vN1yFGz9YSASXS2mZL ecAw== X-Gm-Message-State: AOAM53140a2sgviFJQda6/jUZ70kP//Z5l10rf3NQcc91VtMAh8R9CK1 Ofv6P+06dk3xh5SBwsjIIpEoOwRO33A1yUUzJ8yBCivoq4tRTZsISjN21yftoWRYiGi6uvy3uF3 Swlzgxdsu2NAzsUpGg3Lutg8rnLqzMyrGpGjewFTccw5Isg4aRt+J X-Received: by 2002:a05:6102:31b7:: with SMTP id d23mr6244286vsh.56.1622202678193; 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210528_045122_498511_43A22CC2 X-CRM114-Status: GOOD ( 11.20 ) 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 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; }