mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Aditya Garg <gargaditya08@live.com>
To: Thomas Zimmermann <tzimmermann@suse.de>
Cc: "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>,
	"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 11:50:57 +0000	[thread overview]
Message-ID: <PN3PR01MB959759051DDE76D2EBC58FD5B8C32@PN3PR01MB9597.INDPRD01.PROD.OUTLOOK.COM> (raw)
In-Reply-To: <325bf106-2b5c-4b13-be2a-e05a3c559bde@suse.de>



> On 25 Feb 2025, at 5:19 PM, Thomas Zimmermann <tzimmermann@suse.de> wrote:
> 
> 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.

Alright, should this be kept in the appletbdrm driver as well then?

  reply	other threads:[~2025-02-25 11:51 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
2025-02-25 11:50     ` Aditya Garg [this message]
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=PN3PR01MB959759051DDE76D2EBC58FD5B8C32@PN3PR01MB9597.INDPRD01.PROD.OUTLOOK.COM \
    --to=gargaditya08@live.com \
    --cc=airlied@gmail.com \
    --cc=airlied@redhat.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --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=tzimmermann@suse.de \
    --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

all inboxes | Powered by JetHome®