* [PATCH] video: fbdev: Fix Warning comparing pointer to 0 reported by coccicheck
@ 2019-06-01 15:39 Shobhit Kukreti
2019-06-03 7:20 ` Mathieu Malaterre
0 siblings, 1 reply; 5+ messages in thread
From: Shobhit Kukreti @ 2019-06-01 15:39 UTC (permalink / raw)
To: Bartlomiej Zolnierkiewicz, dri-devel, linux-fbdev; +Cc: shobhitkukreti
drivers/video/fbdev/controlfb.c: WARNING comparing pointer to 0
drivers/video/fbdev/controlfb.c: WARNING comparing pointer to 0
drivers/video/fbdev/controlfb.c: WARNING comparing pointer to 0
Signed-off-by: Shobhit Kukreti <shobhitkukreti@gmail.com>
---
drivers/video/fbdev/controlfb.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/video/fbdev/controlfb.c b/drivers/video/fbdev/controlfb.c
index 7af8db2..07907c5 100644
--- a/drivers/video/fbdev/controlfb.c
+++ b/drivers/video/fbdev/controlfb.c
@@ -182,7 +182,7 @@ int init_module(void)
int ret = -ENXIO;
dp = of_find_node_by_name(NULL, "control");
- if (dp != 0 && !control_of_init(dp))
+ if (dp != NULL && !control_of_init(dp))
ret = 0;
of_node_put(dp);
@@ -580,7 +580,7 @@ static int __init control_init(void)
control_setup(option);
dp = of_find_node_by_name(NULL, "control");
- if (dp != 0 && !control_of_init(dp))
+ if (dp != NULL && !control_of_init(dp))
ret = 0;
of_node_put(dp);
@@ -683,8 +683,8 @@ static int __init control_of_init(struct device_node *dp)
return -ENXIO;
}
p = kzalloc(sizeof(*p), GFP_KERNEL);
- if (p == 0)
- return -ENXIO;
+ if (p == NULL)
+ return -ENOMEM;
control_fb = p; /* save it for cleanups */
/* Map in frame buffer and registers */
--
2.7.4
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] video: fbdev: Fix Warning comparing pointer to 0 reported by coccicheck
2019-06-01 15:39 [PATCH] video: fbdev: Fix Warning comparing pointer to 0 reported by coccicheck Shobhit Kukreti
@ 2019-06-03 7:20 ` Mathieu Malaterre
2019-06-03 11:19 ` [PATCH v2] " shobhitkukreti
0 siblings, 1 reply; 5+ messages in thread
From: Mathieu Malaterre @ 2019-06-03 7:20 UTC (permalink / raw)
To: Shobhit Kukreti
Cc: Linux Fbdev development list, dri-devel, Bartlomiej Zolnierkiewicz
On Sat, Jun 1, 2019 at 5:39 PM Shobhit Kukreti <shobhitkukreti@gmail.com> wrote:
>
> drivers/video/fbdev/controlfb.c: WARNING comparing pointer to 0
> drivers/video/fbdev/controlfb.c: WARNING comparing pointer to 0
> drivers/video/fbdev/controlfb.c: WARNING comparing pointer to 0
>
> Signed-off-by: Shobhit Kukreti <shobhitkukreti@gmail.com>
> ---
> drivers/video/fbdev/controlfb.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/video/fbdev/controlfb.c b/drivers/video/fbdev/controlfb.c
> index 7af8db2..07907c5 100644
> --- a/drivers/video/fbdev/controlfb.c
> +++ b/drivers/video/fbdev/controlfb.c
> @@ -182,7 +182,7 @@ int init_module(void)
> int ret = -ENXIO;
>
> dp = of_find_node_by_name(NULL, "control");
> - if (dp != 0 && !control_of_init(dp))
> + if (dp != NULL && !control_of_init(dp))
> ret = 0;
> of_node_put(dp);
>
> @@ -580,7 +580,7 @@ static int __init control_init(void)
> control_setup(option);
>
> dp = of_find_node_by_name(NULL, "control");
> - if (dp != 0 && !control_of_init(dp))
> + if (dp != NULL && !control_of_init(dp))
> ret = 0;
> of_node_put(dp);
>
> @@ -683,8 +683,8 @@ static int __init control_of_init(struct device_node *dp)
> return -ENXIO;
> }
> p = kzalloc(sizeof(*p), GFP_KERNEL);
> - if (p == 0)
> - return -ENXIO;
> + if (p == NULL)
> + return -ENOMEM;
IMHO the above should be described in the commit message.
> control_fb = p; /* save it for cleanups */
>
> /* Map in frame buffer and registers */
> --
> 2.7.4
>
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v2] video: fbdev: Fix Warning comparing pointer to 0 reported by coccicheck
2019-06-03 7:20 ` Mathieu Malaterre
@ 2019-06-03 11:19 ` shobhitkukreti
2019-06-03 11:57 ` Mathieu Malaterre
0 siblings, 1 reply; 5+ messages in thread
From: shobhitkukreti @ 2019-06-03 11:19 UTC (permalink / raw)
To: malat; +Cc: Shobhit Kukreti, linux-fbdev, dri-devel, b.zolnierkie
From: Shobhit Kukreti <shobhitkukreti@gmail.com>
Fixed Warning Comparing Pointer to 0. Changed return value to -ENOMEM to
report kzalloc failure
drivers/video/fbdev/controlfb.c: WARNING comparing pointer to 0
drivers/video/fbdev/controlfb.c: WARNING comparing pointer to 0
drivers/video/fbdev/controlfb.c: WARNING comparing pointer to 0
Signed-off-by: Shobhit Kukreti <shobhitkukreti@gmail.com>
---
Changes in v2:
- Modified commit message to report change in return type
drivers/video/fbdev/controlfb.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/video/fbdev/controlfb.c b/drivers/video/fbdev/controlfb.c
index 7af8db2..07907c5 100644
--- a/drivers/video/fbdev/controlfb.c
+++ b/drivers/video/fbdev/controlfb.c
@@ -182,7 +182,7 @@ int init_module(void)
int ret = -ENXIO;
dp = of_find_node_by_name(NULL, "control");
- if (dp != 0 && !control_of_init(dp))
+ if (dp != NULL && !control_of_init(dp))
ret = 0;
of_node_put(dp);
@@ -580,7 +580,7 @@ static int __init control_init(void)
control_setup(option);
dp = of_find_node_by_name(NULL, "control");
- if (dp != 0 && !control_of_init(dp))
+ if (dp != NULL && !control_of_init(dp))
ret = 0;
of_node_put(dp);
@@ -683,8 +683,8 @@ static int __init control_of_init(struct device_node *dp)
return -ENXIO;
}
p = kzalloc(sizeof(*p), GFP_KERNEL);
- if (p == 0)
- return -ENXIO;
+ if (p == NULL)
+ return -ENOMEM;
control_fb = p; /* save it for cleanups */
/* Map in frame buffer and registers */
--
2.7.4
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH v2] video: fbdev: Fix Warning comparing pointer to 0 reported by coccicheck
2019-06-03 11:19 ` [PATCH v2] " shobhitkukreti
@ 2019-06-03 11:57 ` Mathieu Malaterre
2019-06-21 11:51 ` Bartlomiej Zolnierkiewicz
0 siblings, 1 reply; 5+ messages in thread
From: Mathieu Malaterre @ 2019-06-03 11:57 UTC (permalink / raw)
To: Shobhit Kukreti
Cc: Linux Fbdev development list, dri-devel, Bartlomiej Zolnierkiewicz
On Mon, Jun 3, 2019 at 1:21 PM <shobhitkukreti@gmail.com> wrote:
>
> From: Shobhit Kukreti <shobhitkukreti@gmail.com>
>
> Fixed Warning Comparing Pointer to 0. Changed return value to -ENOMEM to
> report kzalloc failure
>
> drivers/video/fbdev/controlfb.c: WARNING comparing pointer to 0
> drivers/video/fbdev/controlfb.c: WARNING comparing pointer to 0
> drivers/video/fbdev/controlfb.c: WARNING comparing pointer to 0
>
> Signed-off-by: Shobhit Kukreti <shobhitkukreti@gmail.com>
> ---
> Changes in v2:
> - Modified commit message to report change in return type
>
> drivers/video/fbdev/controlfb.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/video/fbdev/controlfb.c b/drivers/video/fbdev/controlfb.c
> index 7af8db2..07907c5 100644
> --- a/drivers/video/fbdev/controlfb.c
> +++ b/drivers/video/fbdev/controlfb.c
> @@ -182,7 +182,7 @@ int init_module(void)
> int ret = -ENXIO;
>
> dp = of_find_node_by_name(NULL, "control");
> - if (dp != 0 && !control_of_init(dp))
> + if (dp != NULL && !control_of_init(dp))
> ret = 0;
> of_node_put(dp);
>
> @@ -580,7 +580,7 @@ static int __init control_init(void)
> control_setup(option);
>
> dp = of_find_node_by_name(NULL, "control");
> - if (dp != 0 && !control_of_init(dp))
> + if (dp != NULL && !control_of_init(dp))
> ret = 0;
> of_node_put(dp);
>
> @@ -683,8 +683,8 @@ static int __init control_of_init(struct device_node *dp)
> return -ENXIO;
> }
> p = kzalloc(sizeof(*p), GFP_KERNEL);
> - if (p == 0)
> - return -ENXIO;
> + if (p == NULL)
nit: I would have use `!p` (same for the others above). Maybe
checkpatch with --strict would warn for those (can't remember from top
of my head).
Anyway:
Reviewed-by: Mathieu Malaterre <malat@debian.org>
> + return -ENOMEM;
> control_fb = p; /* save it for cleanups */
>
> /* Map in frame buffer and registers */
> --
> 2.7.4
>
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2] video: fbdev: Fix Warning comparing pointer to 0 reported by coccicheck
2019-06-03 11:57 ` Mathieu Malaterre
@ 2019-06-21 11:51 ` Bartlomiej Zolnierkiewicz
0 siblings, 0 replies; 5+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2019-06-21 11:51 UTC (permalink / raw)
To: Mathieu Malaterre, Shobhit Kukreti
Cc: Linux Fbdev development list, dri-devel
On 6/3/19 1:57 PM, Mathieu Malaterre wrote:
> On Mon, Jun 3, 2019 at 1:21 PM <shobhitkukreti@gmail.com> wrote:
>>
>> From: Shobhit Kukreti <shobhitkukreti@gmail.com>
>>
>> Fixed Warning Comparing Pointer to 0. Changed return value to -ENOMEM to
>> report kzalloc failure
>>
>> drivers/video/fbdev/controlfb.c: WARNING comparing pointer to 0
>> drivers/video/fbdev/controlfb.c: WARNING comparing pointer to 0
>> drivers/video/fbdev/controlfb.c: WARNING comparing pointer to 0
>>
>> Signed-off-by: Shobhit Kukreti <shobhitkukreti@gmail.com>
>> ---
>> Changes in v2:
>> - Modified commit message to report change in return type
>>
>> drivers/video/fbdev/controlfb.c | 8 ++++----
>> 1 file changed, 4 insertions(+), 4 deletions(-)
>>
>> diff --git a/drivers/video/fbdev/controlfb.c b/drivers/video/fbdev/controlfb.c
>> index 7af8db2..07907c5 100644
>> --- a/drivers/video/fbdev/controlfb.c
>> +++ b/drivers/video/fbdev/controlfb.c
>> @@ -182,7 +182,7 @@ int init_module(void)
>> int ret = -ENXIO;
>>
>> dp = of_find_node_by_name(NULL, "control");
>> - if (dp != 0 && !control_of_init(dp))
>> + if (dp != NULL && !control_of_init(dp))
>> ret = 0;
>> of_node_put(dp);
>>
>> @@ -580,7 +580,7 @@ static int __init control_init(void)
>> control_setup(option);
>>
>> dp = of_find_node_by_name(NULL, "control");
>> - if (dp != 0 && !control_of_init(dp))
>> + if (dp != NULL && !control_of_init(dp))
>> ret = 0;
>> of_node_put(dp);
>>
>> @@ -683,8 +683,8 @@ static int __init control_of_init(struct device_node *dp)
>> return -ENXIO;
>> }
>> p = kzalloc(sizeof(*p), GFP_KERNEL);
>> - if (p == 0)
>> - return -ENXIO;
>> + if (p == NULL)
>
> nit: I would have use `!p` (same for the others above). Maybe
> checkpatch with --strict would warn for those (can't remember from top
> of my head).
>
> Anyway:
>
> Reviewed-by: Mathieu Malaterre <malat@debian.org>
>
>> + return -ENOMEM;
>> control_fb = p; /* save it for cleanups */
>>
>> /* Map in frame buffer and registers */
Patch queued (with some fixups, please see below) for v5.3, thanks.
Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R&D Institute Poland
Samsung Electronics
From: Shobhit Kukreti <shobhitkukreti@gmail.com>
Subject: [PATCH] video: fbdev: controlfb: fix warnings about comparing pointer to 0
Fix warnings aboout comparing pointer to 0 reported by coccicheck:
drivers/video/fbdev/controlfb.c: WARNING comparing pointer to 0
drivers/video/fbdev/controlfb.c: WARNING comparing pointer to 0
drivers/video/fbdev/controlfb.c: WARNING comparing pointer to 0
Also while at it change return value to -ENOMEM on kzalloc() failure.
Signed-off-by: Shobhit Kukreti <shobhitkukreti@gmail.com>
Reviewed-by: Mathieu Malaterre <malat@debian.org>
[b.zolnierkie: minor fixups]
Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
---
drivers/video/fbdev/controlfb.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
Index: b/drivers/video/fbdev/controlfb.c
===================================================================
--- a/drivers/video/fbdev/controlfb.c
+++ b/drivers/video/fbdev/controlfb.c
@@ -182,7 +182,7 @@ int init_module(void)
int ret = -ENXIO;
dp = of_find_node_by_name(NULL, "control");
- if (dp != 0 && !control_of_init(dp))
+ if (dp && !control_of_init(dp))
ret = 0;
of_node_put(dp);
@@ -580,7 +580,7 @@ static int __init control_init(void)
control_setup(option);
dp = of_find_node_by_name(NULL, "control");
- if (dp != 0 && !control_of_init(dp))
+ if (dp && !control_of_init(dp))
ret = 0;
of_node_put(dp);
@@ -683,8 +683,8 @@ static int __init control_of_init(struct
return -ENXIO;
}
p = kzalloc(sizeof(*p), GFP_KERNEL);
- if (p == 0)
- return -ENXIO;
+ if (!p)
+ return -ENOMEM;
control_fb = p; /* save it for cleanups */
/* Map in frame buffer and registers */
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2019-06-21 11:51 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-01 15:39 [PATCH] video: fbdev: Fix Warning comparing pointer to 0 reported by coccicheck Shobhit Kukreti
2019-06-03 7:20 ` Mathieu Malaterre
2019-06-03 11:19 ` [PATCH v2] " shobhitkukreti
2019-06-03 11:57 ` Mathieu Malaterre
2019-06-21 11:51 ` Bartlomiej Zolnierkiewicz
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).