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; } From patchwork Sun Apr 25 17:48:31 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 12223451 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 CA6A3C433ED for ; Sun, 25 Apr 2021 17:50:57 +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 504206128A for ; Sun, 25 Apr 2021 17:50:57 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 504206128A 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: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=Z9WXL3jA0XLPs/yJkpX6EgRBlLPMMkfasOEn/x920uo=; b=Xw/hIUyyWqZmPJyAqz86n4Kuk dlz3zaeEMPPrAVIz2EBvNbw1aLDGjVZBqVvVFzMrH0wd28TMbA/2BddM3TLhzCRAUI+1H/IPJ4JE7 L2txnZ+mp4i+fz4VFIdPoCZkfW5CLh486RrAJwFtQd9sXAKoz9Fd9ZgJ9t4luHahHE7H1KGtx+38m Dez6ikNfnfusKehX5zfjpNBAMsayz+YO7JXAE5ZKW5HxzniGSbHHTqilioTW9VS3HUv7iGj90rE3O UZPMZL0WAZltPoVZOUdHJ9u5ehitlzWuw1RMPffOkYi95f9p45YOi1pWzZXCMXm53Un6p+de3tvyn MpCDu6mkw==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1laisO-00623Y-71; Sun, 25 Apr 2021 17:49:00 +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-00622w-02 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:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=XPLSoZ/tcqePUCSPTFPBT43x+MShOvw/eATV++A32uY=; b=0ANCR4kzoGG5eHfccDJLQ82Q46 44dFuRQdatYnPGpvFZRyuQAonM1L3+MyUFmcTC00NuTCd2WURAPYuJbNpHczdFLs8kkDqbMrsJpFW Yz6UGA7V7h4eCskhUcZsNCNoHBrwMxoVgnHexEJmjKmGvx1yO3DmUWV5yjApRn8LGpTI/vpqS5Q3q vzcLvFDV2GvKK+xv44mU/+XTbEb5zpyIGas20Tcx5aTTfrK3RvN7PDTwyNS88cG97n5NtOuS26vcO nkz/yhwips+fzG8MfWdWfIRrEqJVVZBcNSsfjCPJmNc5EbYzalZOm2NFmoZW/xvOJnzAWcfSKc58J xlUHdwHg==; Received: from youngberry.canonical.com ([91.189.89.112]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lais6-00FXED-Le for linux-arm-kernel@lists.infradead.org; Sun, 25 Apr 2021 17:48:44 +0000 Received: from mail-ed1-f70.google.com ([209.85.208.70]) by youngberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1lais2-0005DT-0f for linux-arm-kernel@lists.infradead.org; Sun, 25 Apr 2021 17:48:38 +0000 Received: by mail-ed1-f70.google.com with SMTP id f1-20020a0564021941b02903850806bb32so15769014edz.9 for ; Sun, 25 Apr 2021 10:48:38 -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:in-reply-to :references:mime-version:content-transfer-encoding; bh=XPLSoZ/tcqePUCSPTFPBT43x+MShOvw/eATV++A32uY=; b=WTn+3jZ06YNO9asujiL4Aek9fSgovb+NK95bMocjuCA7kUzIRF5TY/pnDqNGu24O94 Uj0DUSxPZ4wDUeNcZSaPrJduT+kvWxSJjsbjyquIlKPE1pP1bg+zIidcZntx98Lm5yzA n/r2bhsceUMm+akKj9Udn4/UrkGxNXQXA/z1IEVcvihX3gF3t1mn7Qaw5rBWFx7/QLPP X+QnIMiSmoyLWgh3EekZEQ/F/N2lkcikuL0a0HLd4MiEK+AcFM0Usfkozl5TKPb1Dx9r A5mEYfe5489DS5aXf2HWSeKQcsB1/r/6gOC9PwPUjStefClQrpvgi5gzYePV7l3xeQZg MTxg== X-Gm-Message-State: AOAM5336Po+C3GVdL1SD2lHTNVbx3rf97t1CGKddkR/3/rcpnGtM1etU 7woA2/WtLo1DIiS+ANT/nGqYP2ckAgM++xMh4jJL1CV5q6bwcGSxzpmUHKF8CZMN6PY0iNsc687 X/iLXbzahBFha3wTVDRyJLTequonUoLh5CGNtKhJxh6+nAy0JE6oY X-Received: by 2002:a17:907:1c01:: with SMTP id nc1mr14535239ejc.283.1619372915988; Sun, 25 Apr 2021 10:48:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxwDYTMcE/A1dbagzjZUokQ/3sexJzDoZwW2rVwFta8ofhbvG82emcgOUJvU4/jj3FwCYRVQw== X-Received: by 2002:a17:907:1c01:: with SMTP id nc1mr14535230ejc.283.1619372915860; Sun, 25 Apr 2021 10:48:35 -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.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 25 Apr 2021 10:48:35 -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 2/2] thermal: sprd: add missing of_node_put for loop iteration Date: Sun, 25 Apr 2021 19:48:31 +0200 Message-Id: <20210425174831.164332-2-krzysztof.kozlowski@canonical.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210425174831.164332-1-krzysztof.kozlowski@canonical.com> References: <20210425174831.164332-1-krzysztof.kozlowski@canonical.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210425_104842_865771_935C570E X-CRM114-Status: GOOD ( 12.26 ) 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/sprd_thermal.c:387:1-23: WARNING: Function "for_each_child_of_node" should have of_node_put() before goto around lines 391. Signed-off-by: Krzysztof Kozlowski Acked-by: Chunyan Zhang --- drivers/thermal/sprd_thermal.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/thermal/sprd_thermal.c b/drivers/thermal/sprd_thermal.c index 3682edb2f466..2778971aaf03 100644 --- a/drivers/thermal/sprd_thermal.c +++ b/drivers/thermal/sprd_thermal.c @@ -388,6 +388,7 @@ static int sprd_thm_probe(struct platform_device *pdev) sen = devm_kzalloc(&pdev->dev, sizeof(*sen), GFP_KERNEL); if (!sen) { ret = -ENOMEM; + of_node_put(sen_child); goto disable_clk; } @@ -397,12 +398,14 @@ static int sprd_thm_probe(struct platform_device *pdev) ret = of_property_read_u32(sen_child, "reg", &sen->id); if (ret) { dev_err(&pdev->dev, "get sensor reg failed"); + of_node_put(sen_child); goto disable_clk; } ret = sprd_thm_sensor_calibration(sen_child, thm, sen); if (ret) { dev_err(&pdev->dev, "efuse cal analysis failed"); + of_node_put(sen_child); goto disable_clk; } @@ -416,6 +419,7 @@ static int sprd_thm_probe(struct platform_device *pdev) dev_err(&pdev->dev, "register thermal zone failed %d\n", sen->id); ret = PTR_ERR(sen->tzd); + of_node_put(sen_child); goto disable_clk; }