Re: [PATCH] drm/drm_gem.c: remove surplus else after return clause

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxx>
---
  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: OpenPGP_signature
Description: OpenPGP digital signature


[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux