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: 427388 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.7 required=3.0 tests=BAYES_00, 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 ED44AC433ED for ; Sun, 25 Apr 2021 17:48:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id AB4FC6128A for ; Sun, 25 Apr 2021 17:48:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230363AbhDYRtQ (ORCPT ); Sun, 25 Apr 2021 13:49:16 -0400 Received: from youngberry.canonical.com ([91.189.89.112]:51428 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230359AbhDYRtQ (ORCPT ); Sun, 25 Apr 2021 13:49:16 -0400 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-0005Bu-7C for linux-pm@vger.kernel.org; Sun, 25 Apr 2021 17:48:35 +0000 Received: by mail-ed1-f69.google.com with SMTP id v5-20020a0564023485b029037ff13253bcso21696232edc.3 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=dxKKHw0Nxjhj1O9EzJ1gAr0NSACUB73kawM7kvAK16RtBrYGQpCp1Ja1RZe3EL+dVP LIKc1pbvoVb87XAHpvfkqDxt2e/eNt+fS/TrQhjjujPXIYl3dFrEMJWpoNlN+VzLd6Be e+tKoQ3SdGrpFkT33cx3zuDGNQixvrK4nMF+MHEIEmkqg2NOqE3p9Z3BGpG+2Y66Xj/z 0N7Ce33v6cinDtehrPAVI3UtaWIzS2EG2UqWUy+4xCbYcgScJsBGINrh17lgFcVhBuR2 dS7XyxN/wH2P+3q0aCBRhd4cxlMyoXFkJ3aDRcOu8PcN3Rxm+CpJ0XQojqhQjqBpH4n9 3/0w== X-Gm-Message-State: AOAM533Y1pyUAIFg/wTw4426RRFdomMrm194d+pBbp2MjBx0+klRyvwV SQim3p1HNPlBh4yeaHinGA4LARiiOlp2P8HJIuJx9F45V9844LFUY9yVHg7wsz0+NFV9v2YpZnE SUb5KxdyRvbxZlBvkuG0iObUpH0DOkVzxZ+YG X-Received: by 2002:a05:6402:254c:: with SMTP id l12mr16391008edb.278.1619372914974; 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 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 Acked-by: Chunyan Zhang 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: 427663 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.7 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable 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 AFACBC43460 for ; Sun, 25 Apr 2021 17:48:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 82D4A6128A for ; Sun, 25 Apr 2021 17:48:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230359AbhDYRtT (ORCPT ); Sun, 25 Apr 2021 13:49:19 -0400 Received: from youngberry.canonical.com ([91.189.89.112]:51450 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230329AbhDYRtS (ORCPT ); Sun, 25 Apr 2021 13:49:18 -0400 Received: from mail-ej1-f69.google.com ([209.85.218.69]) by youngberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1lais1-0005DR-Qs for linux-pm@vger.kernel.org; Sun, 25 Apr 2021 17:48:37 +0000 Received: by mail-ej1-f69.google.com with SMTP id q21-20020a170906a095b029038718807866so388588ejy.19 for ; Sun, 25 Apr 2021 10:48:37 -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=THW7zRULnPOBRONUKBjyfENqK7jwtPwkuolokBQob156EaFfamU4iu80fNJRHarbJN DAGSqPt2KGGIcOFuW5wqfzDJin7leLT3EwjEgDhdCBBOgd2v8dJ10PvUJsqNINnbO1gR dG+f6Atm4DX4w/ryhKcxsSebno4KiaPuuGtmVTqSOvEetnoML2616F5NUlNkZTBUkrwY 1wx6q+y/S2cOhBLMuHxQPP2DRAjZb9m/i6uubPLJb+igomzSdeR44i/7Cn6ZiqkbOLRA Wo9Kj97IpWKqg8WacF9A9xDAF2VPGVZsdNKpGPXgKPpYBdim1wxaMypUKJcLYfgPOSbN 780g== X-Gm-Message-State: AOAM531hP4TYt7CJltDGy75B+rSd7uoUqbpQF2GHCmDmnVER6Fd9/HHF bqkJZtvd/fX96/ZUhz53hpm5F2A+qrNajoiYLROhc9JFm27NoVrD2BXWD1bijpgVTormdarXjuu +RETpRjC3T0kRgGXSaAdFKexEBUv3IZzRgD4n X-Received: by 2002:a17:907:1c01:: with SMTP id nc1mr14535238ejc.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 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/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; }