From: sunran001@208suo.com
To: airlied@gmail.com, daniel@ffwll.ch
Cc: dri-devel@lists.freedesktop.org, nouveau@lists.freedesktop.org,
linux-kernel@vger.kernel.org
Subject: [PATCH] drm/nouveau: Move assignment outside if condition
Date: Tue, 11 Jul 2023 14:59:04 +0800 [thread overview]
Message-ID: <5e8eabb592aaf355e6a29aea1f71a551@208suo.com> (raw)
In-Reply-To: <20230711065751.80206-1-xujianghui@cdjrlc.com>
Fixes the following checkpatch errors:
ERROR: do not use assignment in if condition
Signed-off-by: Ran Sun <sunran001@208suo.com>
---
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 &&
parent reply other threads:[~2023-07-11 6:59 UTC|newest]
Thread overview: expand[flat|nested] mbox.gz Atom feed
[parent not found: <20230711065751.80206-1-xujianghui@cdjrlc.com>]
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=5e8eabb592aaf355e6a29aea1f71a551@208suo.com \
--to=sunran001@208suo.com \
--cc=airlied@gmail.com \
--cc=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nouveau@lists.freedesktop.org \
/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®