video/fbdev/stifb: Delete an error message for a failed memory allocation in stifb_init_fb()
diff mbox

Message ID 7dcd32b6-9691-14a1-29cf-3a746ef5adfc@users.sourceforge.net
State New
Headers show

Commit Message

SF Markus Elfring Nov. 24, 2017, 9:28 p.m. UTC
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Fri, 24 Nov 2017 22:22:06 +0100

Omit an extra message for a memory allocation failure in this function.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/video/fbdev/stifb.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

Comments

Rolf Eike Beer Nov. 24, 2017, 9:30 p.m. UTC | #1
Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Fri, 24 Nov 2017 22:22:06 +0100
> 
> Omit an extra message for a memory allocation failure in this function.
> 
> This issue was detected by using the Coccinelle software.
> 
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> ---
>  drivers/video/fbdev/stifb.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/drivers/video/fbdev/stifb.c b/drivers/video/fbdev/stifb.c
> index 6ded5c198998..fe217a2f7d21 100644
> --- a/drivers/video/fbdev/stifb.c
> +++ b/drivers/video/fbdev/stifb.c
> @@ -1126,10 +1126,8 @@ static int __init stifb_init_fb(struct sti_struct
> *sti, int bpp_pref) int bpp, xres, yres;
> 
>  	fb = kzalloc(sizeof(*fb), GFP_ATOMIC);
> -	if (!fb) {
> -		printk(KERN_ERR "stifb: Could not allocate stifb structure\n");
> +	if (!fb)
>  		return -ENODEV;
> -	}
> 
>  	info = &fb->info;

This should be -ENOMEM.

Eike
Bartlomiej Zolnierkiewicz Dec. 29, 2017, 6:05 p.m. UTC | #2
On Friday, November 24, 2017 10:30:34 PM Rolf Eike Beer wrote:
> Markus Elfring wrote:
> > From: Markus Elfring <elfring@users.sourceforge.net>
> > Date: Fri, 24 Nov 2017 22:22:06 +0100
> > 
> > Omit an extra message for a memory allocation failure in this function.
> > 
> > This issue was detected by using the Coccinelle software.
> > 
> > Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> > ---
> >  drivers/video/fbdev/stifb.c | 4 +---
> >  1 file changed, 1 insertion(+), 3 deletions(-)
> > 
> > diff --git a/drivers/video/fbdev/stifb.c b/drivers/video/fbdev/stifb.c
> > index 6ded5c198998..fe217a2f7d21 100644
> > --- a/drivers/video/fbdev/stifb.c
> > +++ b/drivers/video/fbdev/stifb.c
> > @@ -1126,10 +1126,8 @@ static int __init stifb_init_fb(struct sti_struct
> > *sti, int bpp_pref) int bpp, xres, yres;
> > 
> >  	fb = kzalloc(sizeof(*fb), GFP_ATOMIC);
> > -	if (!fb) {
> > -		printk(KERN_ERR "stifb: Could not allocate stifb structure\n");
> > +	if (!fb)
> >  		return -ENODEV;
> > -	}
> > 
> >  	info = &fb->info;
> 
> This should be -ENOMEM.

Markus, please fix this issue first (before doing cleanups).

Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R&D Institute Poland
Samsung Electronics
SF Markus Elfring Jan. 7, 2018, 11:55 a.m. UTC | #3
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sun, 7 Jan 2018 12:45:54 +0100

Two update suggestions were taken into account.

Markus Elfring (2):
  Return -ENOMEM after a failed kzalloc()
  Delete an error message for a failed memory allocation

 drivers/video/fbdev/stifb.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

Patch
diff mbox

diff --git a/drivers/video/fbdev/stifb.c b/drivers/video/fbdev/stifb.c
index 6ded5c198998..fe217a2f7d21 100644
--- a/drivers/video/fbdev/stifb.c
+++ b/drivers/video/fbdev/stifb.c
@@ -1126,10 +1126,8 @@  static int __init stifb_init_fb(struct sti_struct *sti, int bpp_pref)
 	int bpp, xres, yres;
 
 	fb = kzalloc(sizeof(*fb), GFP_ATOMIC);
-	if (!fb) {
-		printk(KERN_ERR "stifb: Could not allocate stifb structure\n");
+	if (!fb)
 		return -ENODEV;
-	}
 	
 	info = &fb->info;