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/nvkm: do not use assignment in if condition
Date: Mon, 10 Jul 2023 12:07:14 +0800 [thread overview]
Message-ID: <decd9e6f68cbebda22d6648fa7b9b737@208suo.com> (raw)
In-Reply-To: <20230710032131.52747-1-xujianghui@cdjrlc.com>
Assignments in if condition are less readable and error-prone. Fixes
also checkpatch warning:
ERROR: do not use assignment in if condition
Signed-off-by:Ran Sun <sunran001@208suo.com>
---
drivers/gpu/drm/nouveau/nvkm/subdev/i2c/base.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/base.c
b/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/base.c
index 976539de4220..054fa42f1d04 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/base.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/base.c
@@ -286,7 +286,8 @@ nvkm_i2c_new_(const struct nvkm_i2c_func *func,
struct nvkm_device *device,
if (ccbE.share != DCB_I2C_UNUSED) {
const int id = NVKM_I2C_PAD_HYBRID(ccbE.share);
- if (!(pad = nvkm_i2c_pad_find(i2c, id)))
+ pad = nvkm_i2c_pad_find(i2c, id);
+ if (!pad)
ret = func->pad_s_new(i2c, id, &pad);
else
ret = 0;
next parent reply other threads:[~2023-07-10 4:07 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20230710032131.52747-1-xujianghui@cdjrlc.com>
2023-07-10 4:07 ` sunran001 [this message]
2023-07-13 9:11 ` Karol Herbst
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=decd9e6f68cbebda22d6648fa7b9b737@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®