From patchwork Sun May 15 06:41:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anand Moon X-Patchwork-Id: 12850001 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id D00E0C433F5 for ; Sun, 15 May 2022 06:43:32 +0000 (UTC) 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: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=QHOJULi8thnTGRIy/OLQvWWK0Ek/6UoH6Ne5SjWPVJQ=; b=NV/7rAzoKtvFFb yz6TmSd2kdCWX1yDkL5pHhaTIpgAiqMccHWcijA4BtFLvXpGNPyEoUTXl2z/CHeip3sCy0ZCBjW/Y bski2k48RDLJKwRM1V8qrKOQGxeo8v7iajy07qlmnQEDtFQroI3RZjX65dBs6jVxsLmoMnFEq/Okc twMeU0jNwp0Hck5+DQwHtLVKliSQ8E1cBwsFnd3s3sB0vWYH+DqPwZ5dgzYS3Q10VvNVDbyzHf5Ea rjbXP00T//kSNI5/nsuwkEVBK7yeNmkmFgiIE5x4xkTfdw1JNT9/U6wdOWyFp+Eg9KCMdVHjp/JPv liqFKehI+9RGiaEi/ebg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nq7xW-003JsO-SF; Sun, 15 May 2022 06:42:31 +0000 Received: from mail-pl1-x62d.google.com ([2607:f8b0:4864:20::62d]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nq7xP-003JpB-4s for linux-arm-kernel@lists.infradead.org; Sun, 15 May 2022 06:42:24 +0000 Received: by mail-pl1-x62d.google.com with SMTP id q7so242737plx.3 for ; Sat, 14 May 2022 23:42:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=5SvJ/++bycunC3OKTAB9+JnJnOimY+H66XGtoS2w60s=; b=jrwaBKFl5d35QZ+3Gee2JrXoy7jVYCOzlLjUKMZ00zqNMc4yv3WfXcp3A1Irk2aD4y NHYe7fdu1w2rvINacTdaZsuNalurMXEFmu4dajXvHlIF6fEcGSuSAAmI821cUxO7UjLm T6xQdGAjpDNecUPguBmvEsOWjR1ScYtxo3v9VVkxtPaTlR+ZZ53VXeWYZQfx/fFNIilS az/p6n/0+RaYr0W8QnQe3gwjPHsOEx+GTyAjfDIEUoMbDqWNZW5aPLZENyceBVgKT/VO e8GRHJRCpNaEmFe89deWgZRv2GlMK56yVyuKiATL3+K/sJNTjosJiHhakkCww3cKbfZh 2EEw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=5SvJ/++bycunC3OKTAB9+JnJnOimY+H66XGtoS2w60s=; b=Ws2eg5Fk00dS8e3TX1HDePqdhllE/qRJNHmKg9nQyW/Ra8btfz+XpLSxL2pt5raFKc ZnziI8844JO/TEGxvH80TtusKrm+qIrkXDA3P6dHgeOZpyY3yi8nWXDf3RWb9xTtTjLT c+EcqUodvO7DST2F354yKbgnZoFFseCopNvg8V6+CE0r/W5OPojao5sXc/eweeWjK57v 79dXZLiXgQkT7f+3n6upfemAUFx11aWkD7DfzYGCANtoRwF861hTTR/y7Lsz4QGcerwB ArMKUbkaOLZhVPk9tg0iORjXKmhnRPE6jByR1SevV95MHUXzjL3fXXALHX43dGyhifl4 tAfg== X-Gm-Message-State: AOAM531Mqm4XX+vy4VtCpkhrJ3zorVQ6KavWLAgkHAFhQjur/2Da6WLd FLzBxk6/3ZRTS1gQh1ck9Dg= X-Google-Smtp-Source: ABdhPJzWcVVfdugYBkVY7O80ZUsr97cxYMYWRp1vfSYA4vb0IAvOv+WNAehaqvlWeMBCDABHd9zg/A== X-Received: by 2002:a17:90a:ba11:b0:1df:2d09:1308 with SMTP id s17-20020a17090aba1100b001df2d091308mr3500270pjr.184.1652596941625; Sat, 14 May 2022 23:42:21 -0700 (PDT) Received: from alarm.. ([103.51.72.28]) by smtp.gmail.com with ESMTPSA id g24-20020a170902d5d800b0015e8d4eb2e3sm4568687plh.301.2022.05.14.23.42.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 14 May 2022 23:42:21 -0700 (PDT) From: Anand Moon To: Bartlomiej Zolnierkiewicz , Krzysztof Kozlowski , "Rafael J. Wysocki" , Daniel Lezcano , Amit Kucheria , Zhang Rui , Alim Akhtar , linux-pm@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Anand Moon Subject: [PATCHv2 3/6] thermal: exynos: Check before clk_disable_unprepare() not needed Date: Sun, 15 May 2022 06:41:20 +0000 Message-Id: <20220515064126.1424-4-linux.amoon@gmail.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220515064126.1424-1-linux.amoon@gmail.com> References: <20220515064126.1424-1-linux.amoon@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220514_234223_261640_03266D30 X-CRM114-Status: GOOD ( 14.69 ) 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 All code in clk_disable_unprepare() already checks the clk ptr using IS_ERR_OR_NULL so there is no need to check it again before calling it. A lot of other drivers already rely on this behaviour, so it's safe to do so here. Cc: Bartlomiej Zolnierkiewicz Signed-off-by: Anand Moon --- v1: improve the commit message --- drivers/thermal/samsung/exynos_tmu.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/drivers/thermal/samsung/exynos_tmu.c b/drivers/thermal/samsung/exynos_tmu.c index 1ef90dc52c08..58ff1b577c47 100644 --- a/drivers/thermal/samsung/exynos_tmu.c +++ b/drivers/thermal/samsung/exynos_tmu.c @@ -289,8 +289,7 @@ static int exynos_tmu_initialize(struct platform_device *pdev) mutex_lock(&data->lock); clk_enable(data->clk); - if (!IS_ERR(data->clk_sec)) - clk_enable(data->clk_sec); + clk_enable(data->clk_sec); status = readb(data->base + EXYNOS_TMU_REG_STATUS); if (!status) { @@ -323,8 +322,7 @@ static int exynos_tmu_initialize(struct platform_device *pdev) err: clk_disable(data->clk); mutex_unlock(&data->lock); - if (!IS_ERR(data->clk_sec)) - clk_disable(data->clk_sec); + clk_disable(data->clk_sec); out: return ret; } @@ -1119,8 +1117,7 @@ static int exynos_tmu_probe(struct platform_device *pdev) err_thermal: thermal_zone_of_sensor_unregister(&pdev->dev, data->tzd); err_clk_sec: - if (!IS_ERR(data->clk_sec)) - clk_disable_unprepare(data->clk_sec); + clk_disable_unprepare(data->clk_sec); err_sclk: clk_disable_unprepare(data->sclk); err_clk_apbif: @@ -1142,8 +1139,7 @@ static int exynos_tmu_remove(struct platform_device *pdev) clk_disable_unprepare(data->sclk); clk_disable_unprepare(data->clk); - if (!IS_ERR(data->clk_sec)) - clk_disable_unprepare(data->clk_sec); + clk_disable_unprepare(data->clk_sec); if (!IS_ERR(data->regulator)) regulator_disable(data->regulator);