Skip to contentSkip to conversation

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

PATCH In review SF Markus Elfring 3 participants 8 messages Nov 24, 2017 – Mar 28, 2018

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

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

From: Markus Elfring <[email protected]>
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.

---
 drivers/video/fbdev/stifb.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/video/fbdev/stifb.c +1 -3
index 6ded5c198998..fe217a2f7d21 100644
@@ -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;
 
Signature · 1 line
2.15.0
#1 lore raw
Quoted 17 lines · Markus Elfring

From: Markus Elfring <[email protected]>
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.

---
 drivers/video/fbdev/stifb.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/video/fbdev/stifb.c +0 -0
index 6ded5c198998..fe217a2f7d21 100644

drivers/video/fbdev/stifb.c static int __init stifb_init_fb(struct sti_struct · line 1132

Quoted 10 lines
drivers/video/fbdev/stifb.c +1 -3
@@ -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

#2 lore raw
Quoted 27 lines · Rolf Eike Beer
Quoted 26 lines · Markus Elfring

From: Markus Elfring <[email protected]>
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.

---
 drivers/video/fbdev/stifb.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/video/fbdev/stifb.c +1 -3
index 6ded5c198998..fe217a2f7d21 100644
@@ -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;
-	}
 
Quoted 3 lines

drivers/video/fbdev/stifb.c static int __init stifb_init_fb(struct sti_struct *sti, int bpp_pref) · line 1132

Quoted 1 line
drivers/video/fbdev/stifb.c +0 -0
 	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

#3 lore raw

v2 cover video/fbdev/stifb: Adjustments for stifb_init_fb()

From: Markus Elfring <[email protected]>
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(-)
Signature · 1 line
2.15.1
#4 lore raw

PATCH v2 1/2 video/fbdev/stifb: Return -ENOMEM after a failed kzalloc() in stifb_init_fb()

From: Markus Elfring <[email protected]>
Date: Sun, 7 Jan 2018 11:33:59 +0100

Replace an error code for the indication of a memory allocation failure in this function.

Fixes 1da177e4c3f41524e886b7f1b8a0c1fc7321cac ("Linux-2.6.12-rc2: Initial git repository build")
---
 drivers/video/fbdev/stifb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/video/fbdev/stifb.c +1 -1
index 6ded5c198998..511a594889af 100644
@@ -1128,7 +1128,7 @@ static int __init stifb_init_fb(struct sti_struct *sti, int bpp_pref)
 	fb = kzalloc(sizeof(*fb), GFP_ATOMIC);
 	if (!fb) {
 		printk(KERN_ERR "stifb: Could not allocate stifb structure\n");
-		return -ENODEV;
+		return -ENOMEM;
 	}
 	
 	info = &fb->info;
Signature · 1 line
2.15.1
#5 lore raw

Re: [PATCH v2 1/2] video/fbdev/stifb: Return -ENOMEM after a failed kzalloc() in stifb_init_fb()

Quoted 9 lines · SF Markus Elfring

From: Markus Elfring <[email protected]>
Date: Sun, 7 Jan 2018 11:33:59 +0100

Replace an error code for the indication of a memory allocation failure in this function.

Fixes 1da177e4c3f41524e886b7f1b8a0c1fc7321cac ("Linux-2.6.12-rc2: Initial git repository build")

Patch queued for 4.17, thanks.

Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R&D Institute Poland
Samsung Electronics

#6 lore raw

PATCH v2 2/2 video/fbdev/stifb: Delete an error message for a failed memory allocation in stifb_init_fb()

In reply to SF Markus Elfring

From: Markus Elfring <[email protected]>
Date: Sun, 7 Jan 2018 12:34:22 +0100

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

This issue was detected by using the Coccinelle software.

---

v2:
This update suggestion was rebased on source files from the software "Linux next-20180105" together with a change for an error code.

 drivers/video/fbdev/stifb.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/video/fbdev/stifb.c +1 -3
index 511a594889af..dec8efb4f256 100644
@@ -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 -ENOMEM;
-	}
 	
 	info = &fb->info;
 
Signature · 1 line
2.15.1
#7 lore raw
Quoted 8 lines · SF Markus Elfring

From: Markus Elfring <[email protected]>
Date: Sun, 7 Jan 2018 12:34:22 +0100

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

This issue was detected by using the Coccinelle software.

Patch queued for 4.17, thanks.

Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R&D Institute Poland
Samsung Electronics