All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] macintosh: Fix warning comparing pointer to 0
@ 2022-11-06 15:18 wangkailong
  2022-11-06 16:08 ` Christophe JAILLET
  0 siblings, 1 reply; 5+ messages in thread
From: wangkailong @ 2022-11-06 15:18 UTC (permalink / raw)
  To: benh, christophe.leroy, mpe; +Cc: linuxppc-dev, linux-kernel

Fix the following coccicheck warning:

drivers/macintosh/macio-adb.c:103:13-14: WARNING comparing pointer to 0.

Signed-off-by: KaiLong Wang <wangkailong@jari.cn>
---
 drivers/macintosh/macio-adb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/macintosh/macio-adb.c b/drivers/macintosh/macio-adb.c
index 9b63bd2551c6..1c1c375a817d 100644
--- a/drivers/macintosh/macio-adb.c
+++ b/drivers/macintosh/macio-adb.c
@@ -100,7 +100,7 @@ int macio_init(void)
 	unsigned int irq;
 
 	adbs = of_find_compatible_node(NULL, "adb", "chrp,adb0");
-	if (adbs == 0)
+	if (adbs)
 		return -ENXIO;
 
 	if (of_address_to_resource(adbs, 0, &r)) {
-- 
2.25.1

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

* Re: [PATCH] macintosh: Fix warning comparing pointer to 0
  2022-11-06 15:18 [PATCH] macintosh: Fix warning comparing pointer to 0 wangkailong
@ 2022-11-06 16:08 ` Christophe JAILLET
  2022-11-06 17:13   ` Christophe Leroy
  0 siblings, 1 reply; 5+ messages in thread
From: Christophe JAILLET @ 2022-11-06 16:08 UTC (permalink / raw)
  To: wangkailong, benh, christophe.leroy, mpe; +Cc: linuxppc-dev, linux-kernel

Le 06/11/2022 à 16:18, wangkailong@jari.cn a écrit :
> Fix the following coccicheck warning:
> 
> drivers/macintosh/macio-adb.c:103:13-14: WARNING comparing pointer to 0.
> 
> Signed-off-by: KaiLong Wang <wangkailong@jari.cn>
> ---
>   drivers/macintosh/macio-adb.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/macintosh/macio-adb.c b/drivers/macintosh/macio-adb.c
> index 9b63bd2551c6..1c1c375a817d 100644
> --- a/drivers/macintosh/macio-adb.c
> +++ b/drivers/macintosh/macio-adb.c
> @@ -100,7 +100,7 @@ int macio_init(void)
>   	unsigned int irq;
>   
>   	adbs = of_find_compatible_node(NULL, "adb", "chrp,adb0");
> -	if (adbs == 0)
> +	if (adbs)

Hi
no, this should be "if (!adbs)"

CJ

>   		return -ENXIO;
>   
>   	if (of_address_to_resource(adbs, 0, &r)) {


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

* Re: [PATCH] macintosh: Fix warning comparing pointer to 0
  2022-11-06 16:08 ` Christophe JAILLET
@ 2022-11-06 17:13   ` Christophe Leroy
  0 siblings, 0 replies; 5+ messages in thread
From: Christophe Leroy @ 2022-11-06 17:13 UTC (permalink / raw)
  To: Christophe JAILLET, wangkailong, benh, mpe; +Cc: linuxppc-dev, linux-kernel



Le 06/11/2022 à 17:08, Christophe JAILLET a écrit :
> Le 06/11/2022 à 16:18, wangkailong@jari.cn a écrit :
>> Fix the following coccicheck warning:
>>
>> drivers/macintosh/macio-adb.c:103:13-14: WARNING comparing pointer to 0.
>>
>> Signed-off-by: KaiLong Wang <wangkailong@jari.cn>

We already have such patches awaiting for application, see 
https://patchwork.ozlabs.org/project/linuxppc-dev/list/?submitter=83647

Please check patchwork before submitting such fixes as they may already 
exist.

Thanks
Christophe


>> ---
>>   drivers/macintosh/macio-adb.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/macintosh/macio-adb.c 
>> b/drivers/macintosh/macio-adb.c
>> index 9b63bd2551c6..1c1c375a817d 100644
>> --- a/drivers/macintosh/macio-adb.c
>> +++ b/drivers/macintosh/macio-adb.c
>> @@ -100,7 +100,7 @@ int macio_init(void)
>>       unsigned int irq;
>>       adbs = of_find_compatible_node(NULL, "adb", "chrp,adb0");
>> -    if (adbs == 0)
>> +    if (adbs)
> 
> Hi
> no, this should be "if (!adbs)"
> 
> CJ
> 
>>           return -ENXIO;
>>       if (of_address_to_resource(adbs, 0, &r)) {
> 

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

* [PATCH] macintosh: Fix warning comparing pointer to 0
@ 2022-02-14  1:05 ` Yang Li
  0 siblings, 0 replies; 5+ messages in thread
From: Yang Li @ 2022-02-14  1:05 UTC (permalink / raw)
  To: benh; +Cc: linuxppc-dev, linux-kernel, Yang Li, Abaci Robot

Fix the following coccicheck warnings:
./drivers/macintosh/via-cuda.c:240:16-17: WARNING comparing pointer to 0
./drivers/macintosh/via-cuda.c:243:16-17: WARNING comparing pointer to
0, suggest !E
./drivers/macintosh/via-cuda.c:521:23-24: WARNING comparing pointer to 0

Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Signed-off-by: Yang Li <yang.lee@linux.alibaba.com>
---
 drivers/macintosh/via-cuda.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/macintosh/via-cuda.c b/drivers/macintosh/via-cuda.c
index 3d0d0b9d471d..a9feb7d5a068 100644
--- a/drivers/macintosh/via-cuda.c
+++ b/drivers/macintosh/via-cuda.c
@@ -237,10 +237,10 @@ int __init find_via_cuda(void)
     const u32 *reg;
     int err;
 
-    if (vias != 0)
+    if (vias)
 	return 1;
     vias = of_find_node_by_name(NULL, "via-cuda");
-    if (vias == 0)
+    if (!vias)
 	return 0;
 
     reg = of_get_property(vias, "reg", NULL);
@@ -518,7 +518,7 @@ cuda_write(struct adb_request *req)
     req->reply_len = 0;
 
     spin_lock_irqsave(&cuda_lock, flags);
-    if (current_req != 0) {
+    if (current_req) {
 	last_req->next = req;
 	last_req = req;
     } else {
-- 
2.20.1.7.g153144c


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

* [PATCH] macintosh: Fix warning comparing pointer to 0
@ 2022-02-14  1:05 ` Yang Li
  0 siblings, 0 replies; 5+ messages in thread
From: Yang Li @ 2022-02-14  1:05 UTC (permalink / raw)
  To: benh; +Cc: Yang Li, Abaci Robot, linuxppc-dev, linux-kernel

Fix the following coccicheck warnings:
./drivers/macintosh/via-cuda.c:240:16-17: WARNING comparing pointer to 0
./drivers/macintosh/via-cuda.c:243:16-17: WARNING comparing pointer to
0, suggest !E
./drivers/macintosh/via-cuda.c:521:23-24: WARNING comparing pointer to 0

Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Signed-off-by: Yang Li <yang.lee@linux.alibaba.com>
---
 drivers/macintosh/via-cuda.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/macintosh/via-cuda.c b/drivers/macintosh/via-cuda.c
index 3d0d0b9d471d..a9feb7d5a068 100644
--- a/drivers/macintosh/via-cuda.c
+++ b/drivers/macintosh/via-cuda.c
@@ -237,10 +237,10 @@ int __init find_via_cuda(void)
     const u32 *reg;
     int err;
 
-    if (vias != 0)
+    if (vias)
 	return 1;
     vias = of_find_node_by_name(NULL, "via-cuda");
-    if (vias == 0)
+    if (!vias)
 	return 0;
 
     reg = of_get_property(vias, "reg", NULL);
@@ -518,7 +518,7 @@ cuda_write(struct adb_request *req)
     req->reply_len = 0;
 
     spin_lock_irqsave(&cuda_lock, flags);
-    if (current_req != 0) {
+    if (current_req) {
 	last_req->next = req;
 	last_req = req;
     } else {
-- 
2.20.1.7.g153144c


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

end of thread, other threads:[~2022-11-06 17:21 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-06 15:18 [PATCH] macintosh: Fix warning comparing pointer to 0 wangkailong
2022-11-06 16:08 ` Christophe JAILLET
2022-11-06 17:13   ` Christophe Leroy
  -- strict thread matches above, loose matches on Subject: below --
2022-02-14  1:05 Yang Li
2022-02-14  1:05 ` Yang Li

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.