mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Liviu Dudau <liviu.dudau@arm.com>
To: Chen Ni <nichen@iscas.ac.cn>
Cc: maarten.lankhorst@linux.intel.com, mripard@kernel.org,
	tzimmermann@suse.de, airlied@gmail.com, simona@ffwll.ch,
	dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] drm/komeda: Remove unnecessary NULL check before clk_prepare_enable()
Date: Thu, 13 Mar 2025 14:08:42 +0000	[thread overview]
Message-ID: <Z9Lm6nSPphPfupEB@e110455-lin.cambridge.arm.com> (raw)
In-Reply-To: <20250313082907.2481547-1-nichen@iscas.ac.cn>

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!  /
  ---------------
    ¯\_(ツ)_/¯

      reply	other threads:[~2025-03-13 14:08 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-13  8:29 Chen Ni
2025-03-13 14:08 ` Liviu Dudau [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Z9Lm6nSPphPfupEB@e110455-lin.cambridge.arm.com \
    --to=liviu.dudau@arm.com \
    --cc=airlied@gmail.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=mripard@kernel.org \
    --cc=nichen@iscas.ac.cn \
    --cc=simona@ffwll.ch \
    --cc=tzimmermann@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®