nouveau.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* [Nouveau] [PATCH] drm/nouveau/i2c: do not use assignment in if condition
       [not found] <20230710062932.53655-1-xujianghui@cdjrlc.com>
@ 2023-07-10  6:31 ` sunran001
  2023-07-13  9:11   ` Karol Herbst
  0 siblings, 1 reply; 7+ messages in thread
From: sunran001 @ 2023-07-10  6:31 UTC (permalink / raw)
  To: airlied, daniel; +Cc: nouveau, linux-kernel, dri-devel

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/aux.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/aux.c 
b/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/aux.c
index d063d0dc13c5..098051d3755c 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/aux.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/aux.c
@@ -209,7 +209,8 @@ nvkm_i2c_aux_new_(const struct nvkm_i2c_aux_func 
*func,
            struct nvkm_i2c_pad *pad, int id,
            struct nvkm_i2c_aux **paux)
  {
-    if (!(*paux = kzalloc(sizeof(**paux), GFP_KERNEL)))
+    *paux = kzalloc(sizeof(**paux), GFP_KERNEL);
+    if (!*paux)
          return -ENOMEM;
      return nvkm_i2c_aux_ctor(func, pad, id, *paux);
  }

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [Nouveau] [PATCH] drm/nouveau/i2c: do not use assignment in if condition
  2023-07-10  6:31 ` [Nouveau] [PATCH] drm/nouveau/i2c: do not use assignment in if condition sunran001
@ 2023-07-13  9:11   ` Karol Herbst
  0 siblings, 0 replies; 7+ messages in thread
From: Karol Herbst @ 2023-07-13  9:11 UTC (permalink / raw)
  To: sunran001; +Cc: nouveau, dri-devel, linux-kernel, daniel

On Mon, Jul 10, 2023 at 9:23 AM <sunran001@208suo.com> wrote:
>
> 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/aux.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/aux.c
> b/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/aux.c
> index d063d0dc13c5..098051d3755c 100644
> --- a/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/aux.c
> +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/aux.c
> @@ -209,7 +209,8 @@ nvkm_i2c_aux_new_(const struct nvkm_i2c_aux_func
> *func,
>             struct nvkm_i2c_pad *pad, int id,
>             struct nvkm_i2c_aux **paux)
>   {
> -    if (!(*paux = kzalloc(sizeof(**paux), GFP_KERNEL)))
> +    *paux = kzalloc(sizeof(**paux), GFP_KERNEL);
> +    if (!*paux)
>           return -ENOMEM;
>       return nvkm_i2c_aux_ctor(func, pad, id, *paux);
>   }
>

Reviewed-by: Karol Herbst <kherbst@redhat.com>


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Nouveau] [PATCH] drm/nouveau/i2c: do not use assignment in if condition
  2023-07-10  6:37 ` sunran001
@ 2023-07-13  9:08   ` Karol Herbst
  0 siblings, 0 replies; 7+ messages in thread
From: Karol Herbst @ 2023-07-13  9:08 UTC (permalink / raw)
  To: sunran001; +Cc: nouveau, dri-devel, linux-kernel, daniel

Reviewed-by: Karol Herbst <kherbst@redhat.com>

On Mon, Jul 10, 2023 at 9:23 AM <sunran001@208suo.com> wrote:
>
> 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/busgf119.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/busgf119.c
> b/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/busgf119.c
> index 96bbdda0f439..a1cf406ff141 100644
> --- a/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/busgf119.c
> +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/busgf119.c
> @@ -85,7 +85,8 @@ gf119_i2c_bus_new(struct nvkm_i2c_pad *pad, int id, u8
> drive,
>   {
>       struct gf119_i2c_bus *bus;
>
> -    if (!(bus = kzalloc(sizeof(*bus), GFP_KERNEL)))
> +    bus = kzalloc(sizeof(*bus), GFP_KERNEL);
> +    if (!bus)
>           return -ENOMEM;
>       *pbus = &bus->base;
>


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Nouveau] [PATCH] drm/nouveau/i2c: do not use assignment in if condition
       [not found] <20230710063529.53769-1-xujianghui@cdjrlc.com>
@ 2023-07-10  6:37 ` sunran001
  2023-07-13  9:08   ` Karol Herbst
  0 siblings, 1 reply; 7+ messages in thread
From: sunran001 @ 2023-07-10  6:37 UTC (permalink / raw)
  To: airlied, daniel; +Cc: nouveau, linux-kernel, dri-devel

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/busgf119.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/busgf119.c 
b/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/busgf119.c
index 96bbdda0f439..a1cf406ff141 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/busgf119.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/busgf119.c
@@ -85,7 +85,8 @@ gf119_i2c_bus_new(struct nvkm_i2c_pad *pad, int id, u8 
drive,
  {
      struct gf119_i2c_bus *bus;

-    if (!(bus = kzalloc(sizeof(*bus), GFP_KERNEL)))
+    bus = kzalloc(sizeof(*bus), GFP_KERNEL);
+    if (!bus)
          return -ENOMEM;
      *pbus = &bus->base;

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [Nouveau] [PATCH] drm/nouveau/i2c: do not use assignment in if condition
       [not found] <20230710055219.53210-1-xujianghui@cdjrlc.com>
  2023-07-10  6:07 ` sunran001
@ 2023-07-10  6:11 ` sunran001
  1 sibling, 0 replies; 7+ messages in thread
From: sunran001 @ 2023-07-10  6:11 UTC (permalink / raw)
  To: airlied, daniel; +Cc: nouveau, linux-kernel, dri-devel

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/busnv04.c | 0
  1 file changed, 0 insertions(+), 0 deletions(-)
  mode change 100755 => 100644 
drivers/gpu/drm/nouveau/nvkm/subdev/i2c/busnv04.c

diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/busnv04.c 
b/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/busnv04.c
old mode 100755
new mode 100644

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Nouveau] [PATCH] drm/nouveau/i2c: do not use assignment in if condition
       [not found] <20230710055219.53210-1-xujianghui@cdjrlc.com>
@ 2023-07-10  6:07 ` sunran001
  2023-07-10  6:11 ` sunran001
  1 sibling, 0 replies; 7+ messages in thread
From: sunran001 @ 2023-07-10  6:07 UTC (permalink / raw)
  To: airlied, daniel; +Cc: nouveau, linux-kernel, dri-devel

[-- Attachment #1: Type: text/plain, Size: 529 bytes --]


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/busnv04.c | 0
  1 file changed, 0 insertions(+), 0 deletions(-)
  mode change 100755 => 100644 
drivers/gpu/drm/nouveau/nvkm/subdev/i2c/busnv04.c

diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/busnv04.c 
b/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/busnv04.c
old mode 100755
new mode 100644

[-- Attachment #2: Type: text/html, Size: 917 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Nouveau] [PATCH] drm/nouveau/i2c: do not use assignment in if condition
       [not found] <20230710040334.53045-1-xujianghui@cdjrlc.com>
@ 2023-07-10  4:05 ` sunran001
  0 siblings, 0 replies; 7+ messages in thread
From: sunran001 @ 2023-07-10  4:05 UTC (permalink / raw)
  To: airlied, daniel; +Cc: nouveau, linux-kernel, dri-devel

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/pad.c | 0
  1 file changed, 0 insertions(+), 0 deletions(-)
  mode change 100755 => 100644 
drivers/gpu/drm/nouveau/nvkm/subdev/i2c/pad.c

diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/pad.c 
b/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/pad.c
old mode 100755
new mode 100644

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2023-07-13  9:11 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20230710062932.53655-1-xujianghui@cdjrlc.com>
2023-07-10  6:31 ` [Nouveau] [PATCH] drm/nouveau/i2c: do not use assignment in if condition sunran001
2023-07-13  9:11   ` Karol Herbst
     [not found] <20230710063529.53769-1-xujianghui@cdjrlc.com>
2023-07-10  6:37 ` sunran001
2023-07-13  9:08   ` Karol Herbst
     [not found] <20230710055219.53210-1-xujianghui@cdjrlc.com>
2023-07-10  6:07 ` sunran001
2023-07-10  6:11 ` sunran001
     [not found] <20230710040334.53045-1-xujianghui@cdjrlc.com>
2023-07-10  4:05 ` sunran001

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).