dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Zimmermann <tzimmermann@suse.de>
To: Sui Jingfeng <suijingfeng@loongson.cn>,
	Sui Jingfeng <15330273260@189.cn>,
	Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
	Maxime Ripard <mripard@kernel.org>,
	David Airlie <airlied@linux.ie>, Daniel Vetter <daniel@ffwll.ch>,
	liyi <liyi@loongson.cn>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH] drm/drm_gem.c: remove surplus else after return clause
Date: Tue, 20 Jun 2023 16:43:42 +0200	[thread overview]
Message-ID: <163af01e-01cc-008d-333f-964cba9f9130@suse.de> (raw)
In-Reply-To: <cde47fd0-a8e4-36cf-3f0b-a1b473799db3@loongson.cn>


[-- Attachment #1.1: Type: text/plain, Size: 1608 bytes --]

Hi

Am 20.06.23 um 06:08 schrieb Sui Jingfeng:
> ping ?
> 
> On 2023/3/14 20:53, Sui Jingfeng wrote:
>>   else is not generally useful after return

No indention please.

>>
>> Signed-off-by: Sui Jingfeng <15330273260@189.cn>
>> ---
>>   drivers/gpu/drm/drm_gem.c | 7 ++++---
>>   1 file changed, 4 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/drm_gem.c b/drivers/gpu/drm/drm_gem.c
>> index a6208e2c089b..364e3733af98 100644
>> --- a/drivers/gpu/drm/drm_gem.c
>> +++ b/drivers/gpu/drm/drm_gem.c
>> @@ -1150,8 +1150,8 @@ int drm_gem_pin(struct drm_gem_object *obj)
>>   {
>>       if (obj->funcs->pin)
>>           return obj->funcs->pin(obj);
>> -    else
>> -        return 0;
>> +
>> +    return 0;

This change is ok.

>>   }
>>   void drm_gem_unpin(struct drm_gem_object *obj)
>> @@ -1172,7 +1172,8 @@ int drm_gem_vmap(struct drm_gem_object *obj, 
>> struct iosys_map *map)
>>       ret = obj->funcs->vmap(obj, map);
>>       if (ret)
>>           return ret;
>> -    else if (iosys_map_is_null(map))
>> +
>> +    if (iosys_map_is_null(map))
>>           return -ENOMEM;

This is not correct. Calling iosys_map_is_null() is part of handling the 
return value from vmap, so the else is fine.

Best regards
Thomas

>>       return 0;
> 

-- 
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)

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]

  reply	other threads:[~2023-06-20 14:43 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-14 12:53 [PATCH] drm/drm_gem.c: remove surplus else after return clause Sui Jingfeng
2023-06-20  4:08 ` Sui Jingfeng
2023-06-20 14:43   ` Thomas Zimmermann [this message]
2023-06-20 16:06     ` Sui Jingfeng
2023-06-20 16:18       ` Thomas Zimmermann
2023-06-26 12:32         ` Maxime Ripard
2023-06-26 13:20           ` Sui Jingfeng
2023-06-27  8:53             ` Sui Jingfeng
2023-06-27  9:00           ` Thomas Zimmermann
2023-06-27  9:27             ` Sui Jingfeng

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=163af01e-01cc-008d-333f-964cba9f9130@suse.de \
    --to=tzimmermann@suse.de \
    --cc=15330273260@189.cn \
    --cc=airlied@linux.ie \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=liyi@loongson.cn \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=mripard@kernel.org \
    --cc=suijingfeng@loongson.cn \
    /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