Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp11168932pxu; Thu, 31 Dec 2020 01:51:32 -0800 (PST) X-Google-Smtp-Source: ABdhPJw+Z1LT7Fu4g6AXqpu9lQdcI1r8lZ3oS9zwjnieVJpar77NMQZPtGG091uoYdg+Xctt+Lli X-Received: by 2002:a17:906:f8d4:: with SMTP id lh20mr53494550ejb.442.1609408291992; Thu, 31 Dec 2020 01:51:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609408291; cv=none; d=google.com; s=arc-20160816; b=O2D4/Udzh4zNzLBWo68t76KkSrQxOCdpkA1X/FE4+RdcjDTmzyX6jTmvyrckQ+JX4+ Fn43kcl5IuWqILZ1uqQ4id2kTtqyTs83zUV6q4PpESUBBZhi1XII9m29cYjftBQJLlYo rfa28afPzq2pWVN4dZVH3iyLc1wsXo2gjOliNpBrVZLm0HqxBgzEX7j/QUYad/Mv1kMw fLsm8MYr0v/BulPdKmsqP7hAL7H15oEzuxZ62WKXDD220dTdK/nWIwJjF+oV0sajJIN0 Z9ZmD+0HwE/AMIG6RQ0dN7uhlUExFsF+1LW3Q2fFkGNmEiCLc6AYE+RykfGFo9V0fJ47 dKQg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from; bh=oONOBssKD1zt4ADxIs+3Zqak94F/UmzTMDCZO8JHJSk=; b=BnDr7DfNT1rdVw1psFkogNEjKiRAAw78T9Z65QObpR5DaW2qQyEVReI0j/ixON2us5 mZEAXfXD+XTjqnJjFoN3fDOA0Pyn35MPzi8GRmEsawYttJqI3fTTKcNqPw+RGlO5Jsrp GrNH7BekmOMVyQfUk0TbryB+xQkJdXW5CEGVbU75ch1a1OoFHwDqx/Jl3gReSI7OtPYZ q1/wboQz1Xpr/EbYwNh9RErljQ4OzuHlnljKGRFlp45xNC1dQ5u05/Keqv+SjMwE8tJg 8kRCQUxXyZpbL4ajLf6BTyvsONsvhNjJQAYAM9QnX20jxrL6fQUA2taUa5JzJH/rf+Nu 5fAA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ck16si24895131edb.36.2020.12.31.01.51.09; Thu, 31 Dec 2020 01:51:31 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726314AbgLaJun (ORCPT + 99 others); Thu, 31 Dec 2020 04:50:43 -0500 Received: from smtp21.cstnet.cn ([159.226.251.21]:48310 "EHLO cstnet.cn" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726139AbgLaJum (ORCPT ); Thu, 31 Dec 2020 04:50:42 -0500 X-Greylist: delayed 446 seconds by postgrey-1.27 at vger.kernel.org; Thu, 31 Dec 2020 04:50:34 EST Received: from localhost.localdomain (unknown [124.16.141.241]) by APP-01 (Coremail) with SMTP id qwCowABX2H6ynu1f_9FgAA--.43038S2; Thu, 31 Dec 2020 17:49:38 +0800 (CST) From: Xu Wang To: robdclark@gmail.com, sean@poorly.run, airlied@linux.ie, daniel@ffwll.ch, jcrouse@codeaurora.org, tzimmermann@suse.de, abhinavk@codeaurora.org Cc: linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: [PATCH] drm/msm/mdp5: Remove redundant null check before clk_prepare_enable/clk_disable_unprepare Date: Thu, 31 Dec 2020 09:49:35 +0000 Message-Id: <20201231094935.25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_Jr0_Gr1lIxAIcVC2z280aVCY1x0267AKxVW8JVW8JrUvcSsGvfC2Kf nxnUUI43ZEXa7IU5PHUPUUUUU== X-Originating-IP: [124.16.141.241] X-CM-SenderInfo: pyxotu46lvutnvoduhdfq/1tbiCwoHA1z4jszeQgABs+ Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Because clk_prepare_enable() and clk_disable_unprepare() already checked NULL clock parameter, so the additional checks are unnecessary, just remove them. Signed-off-by: Xu Wang --- drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c | 18 ++++++------------ drivers/gpu/drm/msm/disp/mdp5/mdp5_mdss.c | 12 ++++-------- 2 files changed, 10 insertions(+), 20 deletions(-) diff --git a/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c b/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c index 15aed45022bc..8d373d2ffd51 100644 --- a/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c +++ b/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c @@ -303,15 +303,12 @@ static int mdp5_disable(struct mdp5_kms *mdp5_kms) mdp5_kms->enable_count--; WARN_ON(mdp5_kms->enable_count < 0); - if (mdp5_kms->tbu_rt_clk) - clk_disable_unprepare(mdp5_kms->tbu_rt_clk); - if (mdp5_kms->tbu_clk) - clk_disable_unprepare(mdp5_kms->tbu_clk); + clk_disable_unprepare(mdp5_kms->tbu_rt_clk); + clk_disable_unprepare(mdp5_kms->tbu_clk); clk_disable_unprepare(mdp5_kms->ahb_clk); clk_disable_unprepare(mdp5_kms->axi_clk); clk_disable_unprepare(mdp5_kms->core_clk); - if (mdp5_kms->lut_clk) - clk_disable_unprepare(mdp5_kms->lut_clk); + clk_disable_unprepare(mdp5_kms->lut_clk); return 0; } @@ -325,12 +322,9 @@ static int mdp5_enable(struct mdp5_kms *mdp5_kms) clk_prepare_enable(mdp5_kms->ahb_clk); clk_prepare_enable(mdp5_kms->axi_clk); clk_prepare_enable(mdp5_kms->core_clk); - if (mdp5_kms->lut_clk) - clk_prepare_enable(mdp5_kms->lut_clk); - if (mdp5_kms->tbu_clk) - clk_prepare_enable(mdp5_kms->tbu_clk); - if (mdp5_kms->tbu_rt_clk) - clk_prepare_enable(mdp5_kms->tbu_rt_clk); + clk_prepare_enable(mdp5_kms->lut_clk); + clk_prepare_enable(mdp5_kms->tbu_clk); + clk_prepare_enable(mdp5_kms->tbu_rt_clk); return 0; } diff --git a/drivers/gpu/drm/msm/disp/mdp5/mdp5_mdss.c b/drivers/gpu/drm/msm/disp/mdp5/mdp5_mdss.c index 09bd46ad820b..02c6c4b68c68 100644 --- a/drivers/gpu/drm/msm/disp/mdp5/mdp5_mdss.c +++ b/drivers/gpu/drm/msm/disp/mdp5/mdp5_mdss.c @@ -137,10 +137,8 @@ static int mdp5_mdss_enable(struct msm_mdss *mdss) DBG(""); clk_prepare_enable(mdp5_mdss->ahb_clk); - if (mdp5_mdss->axi_clk) - clk_prepare_enable(mdp5_mdss->axi_clk); - if (mdp5_mdss->vsync_clk) - clk_prepare_enable(mdp5_mdss->vsync_clk); + clk_prepare_enable(mdp5_mdss->axi_clk); + clk_prepare_enable(mdp5_mdss->vsync_clk); return 0; } @@ -150,10 +148,8 @@ static int mdp5_mdss_disable(struct msm_mdss *mdss) struct mdp5_mdss *mdp5_mdss = to_mdp5_mdss(mdss); DBG(""); - if (mdp5_mdss->vsync_clk) - clk_disable_unprepare(mdp5_mdss->vsync_clk); - if (mdp5_mdss->axi_clk) - clk_disable_unprepare(mdp5_mdss->axi_clk); + clk_disable_unprepare(mdp5_mdss->vsync_clk); + clk_disable_unprepare(mdp5_mdss->axi_clk); clk_disable_unprepare(mdp5_mdss->ahb_clk); return 0; -- 2.17.1