Skip to contentSkip to conversation

video/fbdev/au1100fb: Adjustments for au1100fb_drv_probe()

PATCH In review SF Markus Elfring 2 participants 7 messages Nov 27, 2017 – Mar 28, 2018

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

cover video/fbdev/au1100fb: Adjustments for au1100fb_drv_probe()

From: Markus Elfring <[email protected]>
Date: Mon, 27 Nov 2017 18:53:21 +0100

Three update suggestions were taken into account
from static source code analysis.

Markus Elfring (3):
Delete an error message for a failed memory allocation Improve a size determination
Delete an unnecessary variable initialisation

 drivers/video/fbdev/au1100fb.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)
Signature · 1 line
2.15.0
#1 lore raw

PATCH 1/3 video: au1100fb: Delete an error message for a failed memory allocation in au1100fb_drv_probe()

From: Markus Elfring <[email protected]>
Date: Mon, 27 Nov 2017 18:14:41 +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/au1100fb.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/video/fbdev/au1100fb.c +1 -3
index 8de42f617d16..cae17d02d804 100644
@@ -418,10 +418,8 @@ static int au1100fb_drv_probe(struct platform_device *dev)
 	/* Allocate new device private */
 	fbdev = devm_kzalloc(&dev->dev, sizeof(struct au1100fb_device),
 			     GFP_KERNEL);
-	if (!fbdev) {
-		print_err("fail to allocate device private record");
+	if (!fbdev)
 		return -ENOMEM;
-	}
 
 	if (au1100fb_setup(fbdev))
 		goto failed;
Signature · 1 line
2.15.0
#3 lore raw

PATCH 2/3 video: au1100fb: Improve a size determination in au1100fb_drv_probe()

In reply to SF Markus Elfring

From: Markus Elfring <[email protected]>
Date: Mon, 27 Nov 2017 18:18:34 +0100

Replace the specification of a data structure by a pointer dereference as the parameter for the operator "sizeof" to make the corresponding size determination a bit safer according to the Linux coding style convention.

This issue was detected by using the Coccinelle software.

---
 drivers/video/fbdev/au1100fb.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/video/fbdev/au1100fb.c +1 -2
index cae17d02d804..1e5b872f0da6 100644
@@ -416,8 +416,7 @@ static int au1100fb_drv_probe(struct platform_device *dev)
 	struct clk *c;
 
 	/* Allocate new device private */
-	fbdev = devm_kzalloc(&dev->dev, sizeof(struct au1100fb_device),
-			     GFP_KERNEL);
+	fbdev = devm_kzalloc(&dev->dev, sizeof(*fbdev), GFP_KERNEL);
 	if (!fbdev)
 		return -ENOMEM;
 
Signature · 1 line
2.15.0
#5 lore raw

PATCH 3/3 video: au1100fb: Delete an unnecessary variable initialisation in au1100fb_drv_probe()

In reply to SF Markus Elfring

From: Markus Elfring <[email protected]>
Date: Mon, 27 Nov 2017 18:40:23 +0100

The local variable "fbdev" will be reassigned by a following statement. Thus omit the explicit initialisation at the beginning.

---
 drivers/video/fbdev/au1100fb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/video/fbdev/au1100fb.c +1 -1
index 1e5b872f0da6..7c9a672e9811 100644
@@ -410,7 +410,7 @@ static int au1100fb_setup(struct au1100fb_device *fbdev)
 
 static int au1100fb_drv_probe(struct platform_device *dev)
 {
-	struct au1100fb_device *fbdev = NULL;
+	struct au1100fb_device *fbdev;
 	struct resource *regs_res;
 	unsigned long page;
 	struct clk *c;
Signature · 1 line
2.15.0
#2 lore raw

Re: [PATCH 1/3] video: au1100fb: Delete an error message for a failed memory allocation in au1100fb_drv_probe()

In reply to SF Markus Elfring
Quoted 8 lines · SF Markus Elfring

From: Markus Elfring <[email protected]>
Date: Mon, 27 Nov 2017 18:14:41 +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

#4 lore raw

Re: [PATCH 2/3] video: au1100fb: Improve a size determination in au1100fb_drv_probe()

In reply to SF Markus Elfring
Quoted 10 lines · SF Markus Elfring

From: Markus Elfring <[email protected]>
Date: Mon, 27 Nov 2017 18:18:34 +0100

Replace the specification of a data structure by a pointer dereference as the parameter for the operator "sizeof" to make the corresponding size determination a bit safer according to the Linux coding style convention.

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

#6 lore raw

Re: [PATCH 3/3] video: au1100fb: Delete an unnecessary variable initialisation in au1100fb_drv_probe()

In reply to SF Markus Elfring
Quoted 7 lines · SF Markus Elfring

From: Markus Elfring <[email protected]>
Date: Mon, 27 Nov 2017 18:40:23 +0100

The local variable "fbdev" will be reassigned by a following statement. Thus omit the explicit initialisation at the beginning.

Patch queued for 4.17, thanks.

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