diff mbox series

drivers/video/fbdev:modify 0 to NULL

Message ID 20210318023329.488-1-tangchunyou@163.com (mailing list archive)
State Superseded, archived
Headers show
Series drivers/video/fbdev:modify 0 to NULL | expand

Commit Message

ChunyouTang March 18, 2021, 2:33 a.m. UTC
From: tangchunyou <tangchunyou@yulong.com>

modify 0 to NULL,info is a pointer,it should be

compared with NULL,not 0

Signed-off-by: tangchunyou <tangchunyou@yulong.com>
---
 drivers/video/fbdev/offb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Gustavo A. R. Silva March 18, 2021, 1:41 a.m. UTC | #1
On 3/17/21 21:33, ChunyouTang wrote:
> From: tangchunyou <tangchunyou@yulong.com>
> 
> modify 0 to NULL,info is a pointer,it should be
> 
> compared with NULL,not 0
> 
> Signed-off-by: tangchunyou <tangchunyou@yulong.com>
> ---
>  drivers/video/fbdev/offb.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/video/fbdev/offb.c b/drivers/video/fbdev/offb.c
> index 4501e84..cd1042f 100644
> --- a/drivers/video/fbdev/offb.c
> +++ b/drivers/video/fbdev/offb.c
> @@ -412,7 +412,7 @@ static void __init offb_init_fb(const char *name,
>  
>  	info = framebuffer_alloc(sizeof(u32) * 16, NULL);
>  
> -	if (info == 0) {
> +	if (info == NULL) {

if (!info) is better.

--
Gustavo

>  		release_mem_region(res_start, res_size);
>  		return;
>  	}
>
Gustavo A. R. Silva March 18, 2021, 1:54 a.m. UTC | #2
On 3/17/21 21:47, Chunyou Tang wrote:

> I think "if (info == NULL)" is more intuitive,and there have many
> compare likes "if (info == NULL)" in this file.

In that case, all those instances should be changed to if (!foo), instead.

--
Gustavo
ChunyouTang March 18, 2021, 2:47 a.m. UTC | #3
HI,Gustavo

On Wed, 17 Mar 2021 20:41:15 -0500
"Gustavo A. R. Silva" <gustavo@embeddedor.com> wrote:

> On 3/17/21 21:33, ChunyouTang wrote:
> > From: tangchunyou <tangchunyou@yulong.com>
> > 
> > modify 0 to NULL,info is a pointer,it should be
> > 
> > compared with NULL,not 0
> > 
> > Signed-off-by: tangchunyou <tangchunyou@yulong.com>
> > ---
> >  drivers/video/fbdev/offb.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/drivers/video/fbdev/offb.c b/drivers/video/fbdev/offb.c
> > index 4501e84..cd1042f 100644
> > --- a/drivers/video/fbdev/offb.c
> > +++ b/drivers/video/fbdev/offb.c
> > @@ -412,7 +412,7 @@ static void __init offb_init_fb(const char
> > *name, 
> >  	info = framebuffer_alloc(sizeof(u32) * 16, NULL);
> >  
> > -	if (info == 0) {
> > +	if (info == NULL) {  
> 
> if (!info) is better.
> 
> --
> Gustavo
> 
> >  		release_mem_region(res_start, res_size);
> >  		return;
> >  	}
> >   

I think "if (info == NULL)" is more intuitive,and there have many
compare likes "if (info == NULL)" in this file.

--
ChunyouTang
ChunyouTang March 18, 2021, 2:56 a.m. UTC | #4
Hi,Gustavo

On Wed, 17 Mar 2021 20:54:41 -0500
"Gustavo A. R. Silva" <gustavo@embeddedor.com> wrote:

> On 3/17/21 21:47, Chunyou Tang wrote:
> 
> > I think "if (info == NULL)" is more intuitive,and there have many
> > compare likes "if (info == NULL)" in this file.  
> 
> In that case, all those instances should be changed to if (!foo),
> instead.
> 
> --
> Gustavo

OK,I change it.

--
ChunyouTang
diff mbox series

Patch

diff --git a/drivers/video/fbdev/offb.c b/drivers/video/fbdev/offb.c
index 4501e84..cd1042f 100644
--- a/drivers/video/fbdev/offb.c
+++ b/drivers/video/fbdev/offb.c
@@ -412,7 +412,7 @@  static void __init offb_init_fb(const char *name,
 
 	info = framebuffer_alloc(sizeof(u32) * 16, NULL);
 
-	if (info == 0) {
+	if (info == NULL) {
 		release_mem_region(res_start, res_size);
 		return;
 	}