Linux virtualization list
 help / color / mirror / Atom feed
From: Thomas Zimmermann <tzimmermann@suse.de>
To: Aditya Garg <gargaditya08@live.com>,
	"airlied@redhat.com" <airlied@redhat.com>,
	"jfalempe@redhat.com" <jfalempe@redhat.com>,
	"maarten.lankhorst@linux.intel.com"
	<maarten.lankhorst@linux.intel.com>,
	"mripard@kernel.org" <mripard@kernel.org>,
	"airlied@gmail.com" <airlied@gmail.com>,
	"simona@ffwll.ch" <simona@ffwll.ch>,
	"kraxel@redhat.com" <kraxel@redhat.com>,
	"javierm@redhat.com" <javierm@redhat.com>
Cc: "dri-devel@lists.freedesktop.org"
	<dri-devel@lists.freedesktop.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"virtualization@lists.linux.dev" <virtualization@lists.linux.dev>,
	"andriy.shevchenko@linux.intel.com"
	<andriy.shevchenko@linux.intel.com>
Subject: Re: [PATCH 1/6] drm/ast: Remove redundant else in atomic_check
Date: Tue, 25 Feb 2025 12:49:20 +0100	[thread overview]
Message-ID: <325bf106-2b5c-4b13-be2a-e05a3c559bde@suse.de> (raw)
In-Reply-To: <BD2BA1E2-D61E-4D25-857C-C9F435D41EF3@live.com>

Hi

Am 25.02.25 um 12:06 schrieb Aditya Garg:
> From: Aditya Garg <gargaditya08@live.com>
>
> Remove the redundant else statement from atomic_check since the previous if
> statement was returning if true.
>
> Signed-off-by: Aditya Garg <gargaditya08@live.com>
> ---
>   drivers/gpu/drm/ast/ast_mode.c | 5 +++--
>   1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/ast/ast_mode.c b/drivers/gpu/drm/ast/ast_mode.c
> index 9d5321c81..3817d1e4c 100644
> --- a/drivers/gpu/drm/ast/ast_mode.c
> +++ b/drivers/gpu/drm/ast/ast_mode.c
> @@ -610,9 +610,10 @@ static int ast_primary_plane_helper_atomic_check(struct drm_plane *plane,
>   						  DRM_PLANE_NO_SCALING,
>   						  DRM_PLANE_NO_SCALING,
>   						  false, true);
> -	if (ret) {
> +	if (ret)
>   		return ret;
> -	} else if (!new_plane_state->visible) {
> +
> +	if (!new_plane_state->visible) {

I've seen this posted before.

The reason why there is an 'else' branch here is that both branches 
handle the state returned by the function call above, 
drm_atomic_helper_check_plane_state(). First it does an error check, and 
then it tests for >visible. In both cases, the plane's atomic_check 
should return. And only if we have a valid and visible plane, we do the 
actual checks on the plane. Conceptually, these if-else cases belong 
together and signal an early-out from the call.

I'd prefer to keep the drivers as they are.

Best regards
Thomas


>   		if (drm_WARN_ON(dev, new_plane_state->crtc)) /* cannot legally happen */
>   			return -EINVAL;
>   		else

-- 
--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstrasse 146, 90461 Nuernberg, Germany
GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman
HRB 36809 (AG Nuernberg)


  reply	other threads:[~2025-02-25 11:49 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-25 11:05 [PATCH 0/6] drm: remove redundant else across drivers Aditya Garg
2025-02-25 11:06 ` [PATCH 1/6] drm/ast: Remove redundant else in atomic_check Aditya Garg
2025-02-25 11:49   ` Thomas Zimmermann [this message]
2025-02-25 11:50     ` Aditya Garg
2025-02-25 11:06 ` [PATCH 2/6] drm/cirrus-qemu: " Aditya Garg
2025-02-25 11:07 ` [PATCH 3/6] drm/offdrm: " Aditya Garg
2025-02-25 11:07 ` [PATCH 4/6] drm/bochs: " Aditya Garg
2025-02-25 11:08 ` [PATCH 5/6] drm/simpledrm: " Aditya Garg
2025-02-25 11:08 ` [PATCH 6/6] drm/mgag200: " Aditya Garg

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=325bf106-2b5c-4b13-be2a-e05a3c559bde@suse.de \
    --to=tzimmermann@suse.de \
    --cc=airlied@gmail.com \
    --cc=airlied@redhat.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=gargaditya08@live.com \
    --cc=javierm@redhat.com \
    --cc=jfalempe@redhat.com \
    --cc=kraxel@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=mripard@kernel.org \
    --cc=simona@ffwll.ch \
    --cc=virtualization@lists.linux.dev \
    /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