* [PATCH] macintosh/adb: Fix warning comparing pointer to 0
@ 2022-11-06 15:28 wangkailong
2022-11-06 16:12 ` Christophe JAILLET
0 siblings, 1 reply; 3+ messages in thread
From: wangkailong @ 2022-11-06 15:28 UTC (permalink / raw)
To: benh, mpe, gregkh, sohu0106, christophe.leroy; +Cc: linuxppc-dev, linux-kernel
Fix the following coccicheck warning:
drivers/macintosh/adb.c:676:14-15: WARNING comparing pointer to 0.
Signed-off-by: KaiLong Wang <wangkailong@jari.cn>
---
drivers/macintosh/adb.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/macintosh/adb.c b/drivers/macintosh/adb.c
index 1bbb9ca08d40..076253599bd4 100644
--- a/drivers/macintosh/adb.c
+++ b/drivers/macintosh/adb.c
@@ -673,7 +673,7 @@ static int adb_open(struct inode *inode, struct file *file)
goto out;
}
state = kmalloc(sizeof(struct adbdev_state), GFP_KERNEL);
- if (state == 0) {
+ if (state) {
ret = -ENOMEM;
goto out;
}
--
2.25.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] macintosh/adb: Fix warning comparing pointer to 0
2022-11-06 15:28 [PATCH] macintosh/adb: Fix warning comparing pointer to 0 wangkailong
@ 2022-11-06 16:12 ` Christophe JAILLET
2022-11-06 17:13 ` Christophe Leroy
0 siblings, 1 reply; 3+ messages in thread
From: Christophe JAILLET @ 2022-11-06 16:12 UTC (permalink / raw)
To: wangkailong, benh, mpe, gregkh, sohu0106, christophe.leroy
Cc: linuxppc-dev, linux-kernel
Le 06/11/2022 à 16:28, wangkailong@jari.cn a écrit :
> Fix the following coccicheck warning:
>
> drivers/macintosh/adb.c:676:14-15: WARNING comparing pointer to 0.
>
> Signed-off-by: KaiLong Wang <wangkailong@jari.cn>
> ---
> drivers/macintosh/adb.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/macintosh/adb.c b/drivers/macintosh/adb.c
> index 1bbb9ca08d40..076253599bd4 100644
> --- a/drivers/macintosh/adb.c
> +++ b/drivers/macintosh/adb.c
> @@ -673,7 +673,7 @@ static int adb_open(struct inode *inode, struct file *file)
> goto out;
> }
> state = kmalloc(sizeof(struct adbdev_state), GFP_KERNEL);
> - if (state == 0) {
> + if (state) {
Hi
no, this should be "if (!state)"
CJ
> ret = -ENOMEM;
> goto out;
> }
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] macintosh/adb: Fix warning comparing pointer to 0
2022-11-06 16:12 ` Christophe JAILLET
@ 2022-11-06 17:13 ` Christophe Leroy
0 siblings, 0 replies; 3+ messages in thread
From: Christophe Leroy @ 2022-11-06 17:13 UTC (permalink / raw)
To: Christophe JAILLET, wangkailong, benh, mpe, gregkh, sohu0106
Cc: linuxppc-dev, linux-kernel
Le 06/11/2022 à 17:12, Christophe JAILLET a écrit :
> Le 06/11/2022 à 16:28, wangkailong@jari.cn a écrit :
>> Fix the following coccicheck warning:
>>
>> drivers/macintosh/adb.c:676:14-15: 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/adb.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/macintosh/adb.c b/drivers/macintosh/adb.c
>> index 1bbb9ca08d40..076253599bd4 100644
>> --- a/drivers/macintosh/adb.c
>> +++ b/drivers/macintosh/adb.c
>> @@ -673,7 +673,7 @@ static int adb_open(struct inode *inode, struct
>> file *file)
>> goto out;
>> }
>> state = kmalloc(sizeof(struct adbdev_state), GFP_KERNEL);
>> - if (state == 0) {
>> + if (state) {
>
> Hi
> no, this should be "if (!state)"
>
> CJ
>
>> ret = -ENOMEM;
>> goto out;
>> }
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-11-06 17:21 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-06 15:28 [PATCH] macintosh/adb: Fix warning comparing pointer to 0 wangkailong
2022-11-06 16:12 ` Christophe JAILLET
2022-11-06 17:13 ` Christophe Leroy
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®