From patchwork Sun Apr 25 17:48:30 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 12223449 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.0 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,URIBL_BLOCKED, 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 71890C433B4 for ; Sun, 25 Apr 2021 17:50:45 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (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 C94D461288 for ; Sun, 25 Apr 2021 17:50:44 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C94D461288 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=desiato.20200630; 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=pI4GaG4PqOS6uJSgweW+Yiwm7rQAkRI/D3a2HPfdzeI=; b=JmbVgiNpVbb6SQj/ik3I/Txqdh 5aB/s/wqeWBuGXo1aNi5QsGwA2v3/0qRdY6FSSmZFJyjjFvFHGmkYjY4xIftJtOG0dNOCXkRYKgMK J0FFe2QKlyrXNDmd6paptvtLjszLn1hnx0lBiezoD0yN9K7rsDNTg3Y+Hh/xHnvGXl3gM1Lms6lhk Zirqj6vZU9Jpl5CUxCcPeQ0ayvKB3Bah5mPX+T9JjNf39nQacaB/neJRnxWBZfp26fTPWGH8MKcm6 cnbMmPlvfSecLFIbqyOXr92Ei2pOo3ReEDimk9BYG5WN/u/xUbeqhp/Uvhs1/7lC3QhoLpDgtyS9k n7mMq0Sg==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1laisD-00623J-FT; Sun, 25 Apr 2021 17:48:49 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1laisB-00622x-01 for linux-arm-kernel@desiato.infradead.org; Sun, 25 Apr 2021 17:48:47 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type: Content-ID:Content-Description:In-Reply-To:References; bh=kVodXUWFIv1StlNhsCxeISwWmMQVwpJ7c9xxG779QVA=; b=G6xvyORsblFdfTmLC/k/ZpIqEX FZnVT5WIKhfMeGrSB+nZHx+WtnUj+v7O7TlsA7aU+4BgdiCdMJj9jZmcToN8ZxsRtFgD90+7f1qwV cPV2HG436k74B1rQuQA4kZ45ToQ27evFruDoYxiR0kFRX0P7lGn2mwZgF9VL+93GJdfKwO2qozAzy o9ryAsmou+DNsXXfvHbUNxvqe5Ki849s6lt9/MhU5hDB/bnFaAOk7/keFI26/5av66L3hx2brrOl2 1DGXFtaYgBPHoDj53GY8wjDdHMBGv6A50Bhkrpq9Io0k45nKuGDa1Kx74SUqAb6AkWuP1pqgSiV5Q BHNUlU3Q==; Received: from youngberry.canonical.com ([91.189.89.112]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lais6-00FXE7-Mc for linux-arm-kernel@lists.infradead.org; Sun, 25 Apr 2021 17:48:44 +0000 Received: from mail-ed1-f69.google.com ([209.85.208.69]) by youngberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1lairz-0005Bt-7H for linux-arm-kernel@lists.infradead.org; Sun, 25 Apr 2021 17:48:35 +0000 Received: by mail-ed1-f69.google.com with SMTP id n2-20020a0564025142b02903875396c18bso2444356edd.14 for ; Sun, 25 Apr 2021 10:48:35 -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=kVodXUWFIv1StlNhsCxeISwWmMQVwpJ7c9xxG779QVA=; b=ckJHQGDRu6MBet3aOCjwkuSEaXiYXNM7vry16Co9EXPxeEw5Vtkv2SeBnWSrqrHdAz 90LlDrxpz60eI1Reg3HxVWEd6e+QL+VSAuZeFROtZIM7JgqqlWh+I05v9GUlP3avKkrN yul/lPms4daLpoWtnOq+ObsMT9/GMjgLuVkcGed9QagV6bn0lVtsnLFDgookCZVGR4Pm n3hrIYSvUiDOFLdM6TOAQYQq9PphJ56pLUOJ3jqYOlnIdeYgrrh7MFyUAA6xu/M7kn2O 3M8R+KPPFtEMXJYWqtlSEfbrP1exce3Hs5TdTGCiwM1hNTLaCub+ejHFCJHCjMpaQsyN faCg== X-Gm-Message-State: AOAM532IVI2fFsK9LfGCc6JBz5gHM77UEe7WOAAMrnCsxXHS5FL85o/a +rXheRlyx5hF0/r3Uk0m/hQyohPklVGpu2lHxoXoYLqlCL8P7FtdZwweA9U7YR7UYq8R4JwtxUA Qa4WFsKM5CRFJEZDPKKbirrvzkyfZy9bbrQiegx02vJ59Fyr4jOs7 X-Received: by 2002:a05:6402:254c:: with SMTP id l12mr16391002edb.278.1619372914973; Sun, 25 Apr 2021 10:48:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzolb7zLjAcU4+/dDd+2aB9KGmAzm0XhLGhZiJ9wmqpb2ijBM0MhQ3z5v8iz+L3Nl+EgH6O+A== X-Received: by 2002:a05:6402:254c:: with SMTP id l12mr16390994edb.278.1619372914855; Sun, 25 Apr 2021 10:48:34 -0700 (PDT) Received: from localhost.localdomain (xdsl-188-155-180-75.adslplus.ch. [188.155.180.75]) by smtp.gmail.com with ESMTPSA id c12sm10306849eja.12.2021.04.25.10.48.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 25 Apr 2021 10:48:34 -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 Subject: [PATCH 1/2] thermal: imx_sc: add missing of_node_put for loop iteration Date: Sun, 25 Apr 2021 19:48:30 +0200 Message-Id: <20210425174831.164332-1-krzysztof.kozlowski@canonical.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210425_104842_885853_D14D2F73 X-CRM114-Status: GOOD ( 11.61 ) 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; }