[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <Z9Lm6nSPphPfupEB@e110455-lin.cambridge.arm.com>
Date: Thu, 13 Mar 2025 14:08:42 +0000
From: Liviu Dudau <liviu.dudau@....com>
To: Chen Ni <nichen@...as.ac.cn>
Cc: maarten.lankhorst@...ux.intel.com, mripard@...nel.org,
tzimmermann@...e.de, airlied@...il.com, simona@...ll.ch,
dri-devel@...ts.freedesktop.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] drm/komeda: Remove unnecessary NULL check before
clk_prepare_enable()
On Thu, Mar 13, 2025 at 04:29:07PM +0800, Chen Ni wrote:
> clk_prepare_enable() already checked NULL clock parameter.
> Remove unneeded NULL check for clk here.
You're not saving anything here. If mdev->aclk is NULL you still end up
calling clk_prepare() and clk_enable() even if they return zero immediately.
And if you don't like the check for mdev->aclk not being NULL, you should
also move the clk_disable_unprepare() call outside the if() {...} block.
Best regards,
Liviu
>
> Signed-off-by: Chen Ni <nichen@...as.ac.cn>
> ---
> drivers/gpu/drm/arm/display/komeda/komeda_dev.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_dev.c b/drivers/gpu/drm/arm/display/komeda/komeda_dev.c
> index 5ba62e637a61..2b59830f0572 100644
> --- a/drivers/gpu/drm/arm/display/komeda/komeda_dev.c
> +++ b/drivers/gpu/drm/arm/display/komeda/komeda_dev.c
> @@ -282,8 +282,7 @@ void komeda_dev_destroy(struct komeda_dev *mdev)
>
> debugfs_remove_recursive(mdev->debugfs_root);
>
> - if (mdev->aclk)
> - clk_prepare_enable(mdev->aclk);
> + clk_prepare_enable(mdev->aclk);
>
> for (i = 0; i < mdev->n_pipelines; i++) {
> komeda_pipeline_destroy(mdev, mdev->pipelines[i]);
> --
> 2.25.1
>
--
====================
| I would like to |
| fix the world, |
| but they're not |
| giving me the |
\ source code! /
---------------
¯\_(ツ)_/¯
Powered by blists - more mailing lists