[PATCH] drm/nouveau: Move assignment outside if condition

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

 



Fixes the following checkpatch errors:

ERROR: do not use assignment in if condition

Signed-off-by: Ran Sun <sunran001@xxxxxxxxxx>
---
 drivers/gpu/drm/nouveau/nouveau_usif.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/nouveau/nouveau_usif.c b/drivers/gpu/drm/nouveau/nouveau_usif.c
index 002d1479ba89..d0b555630a6f 100644
--- a/drivers/gpu/drm/nouveau/nouveau_usif.c
+++ b/drivers/gpu/drm/nouveau/nouveau_usif.c
@@ -57,7 +57,8 @@ usif_object_new(struct drm_file *f, void *data, u32 size, void *argv, u32 argc,
     struct usif_object *object;
     int ret = -ENOSYS;

-    if ((ret = nvif_unpack(ret, &data, &size, args->v0, 0, 0, true)))
+    ret = nvif_unpack(ret, &data, &size, args->v0, 0, 0, true);
+    if (ret)
         return ret;

     switch (args->v0.oclass) {
@@ -70,7 +71,8 @@ usif_object_new(struct drm_file *f, void *data, u32 size, void *argv, u32 argc,
             struct nv_device_v0 v0;
         } *args = data;

- if ((ret = nvif_unpack(ret, &data, &size, args->v0, 0, 0, false)))
+        ret = nvif_unpack(ret, &data, &size, args->v0, 0, 0, false);
+        if (ret)
             return ret;

         args->v0.priv = false;
@@ -82,7 +84,8 @@ usif_object_new(struct drm_file *f, void *data, u32 size, void *argv, u32 argc,
         break;
     }

-    if (!(object = kmalloc(sizeof(*object), GFP_KERNEL)))
+    object = kmalloc(sizeof(*object), GFP_KERNEL);
+    if (!object)
         return -ENOMEM;
     list_add(&object->head, &cli->objects);

@@ -121,7 +124,8 @@ usif_ioctl(struct drm_file *filp, void __user *user, u32 argc)
     if (ret = -EFAULT, copy_from_user(argv, user, size))
         goto done;

- if (!(ret = nvif_unpack(-ENOSYS, &data, &size, argv->v0, 0, 0, true))) {
+    ret = nvif_unpack(-ENOSYS, &data, &size, argv->v0, 0, 0, true);
+    if (!ret) {
         /* block access to objects not created via this interface */
         owner = argv->v0.owner;
         if (argv->v0.object == 0ULL &&



[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