* [PATCH] drm/komeda: Remove unnecessary NULL check before clk_prepare_enable()
@ 2025-03-13 8:29 Chen Ni
2025-03-13 14:08 ` Liviu Dudau
0 siblings, 1 reply; 2+ messages in thread
From: Chen Ni @ 2025-03-13 8:29 UTC (permalink / raw)
To: liviu.dudau, maarten.lankhorst, mripard, tzimmermann, airlied,
simona, dri-devel, linux-kernel
Cc: Chen Ni
clk_prepare_enable() already checked NULL clock parameter.
Remove unneeded NULL check for clk here.
Signed-off-by: Chen Ni <nichen@iscas.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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] drm/komeda: Remove unnecessary NULL check before clk_prepare_enable()
2025-03-13 8:29 [PATCH] drm/komeda: Remove unnecessary NULL check before clk_prepare_enable() Chen Ni
@ 2025-03-13 14:08 ` Liviu Dudau
0 siblings, 0 replies; 2+ messages in thread
From: Liviu Dudau @ 2025-03-13 14:08 UTC (permalink / raw)
To: Chen Ni
Cc: maarten.lankhorst, mripard, tzimmermann, airlied, simona,
dri-devel, linux-kernel
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@iscas.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! /
---------------
¯\_(ツ)_/¯
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-03-13 14:08 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-13 8:29 [PATCH] drm/komeda: Remove unnecessary NULL check before clk_prepare_enable() Chen Ni
2025-03-13 14:08 ` Liviu Dudau
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox