[PATCH 0/3] video/fbdev/au1100fb: Adjustments for au1100fb_drv_probe()

STALE3074d

7 messages, 2 authors, 2018-03-28 · open the first message on its own page

[PATCH 0/3] video/fbdev/au1100fb: Adjustments for au1100fb_drv_probe()

From: SF Markus Elfring <hidden>
Date: 2017-11-27 17:57:44

From: Markus Elfring <redacted>
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(-)

-- 
2.15.0

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

From: SF Markus Elfring <hidden>
Date: 2017-11-27 17:59:04

From: Markus Elfring <redacted>
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.

Signed-off-by: Markus Elfring <redacted>
---
 drivers/video/fbdev/au1100fb.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/video/fbdev/au1100fb.c b/drivers/video/fbdev/au1100fb.c
index 8de42f617d16..cae17d02d804 100644
--- a/drivers/video/fbdev/au1100fb.c
+++ b/drivers/video/fbdev/au1100fb.c
@@ -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;
-- 
2.15.0

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

From: SF Markus Elfring <hidden>
Date: 2017-11-27 18:00:09

From: Markus Elfring <redacted>
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.

Signed-off-by: Markus Elfring <redacted>
---
 drivers/video/fbdev/au1100fb.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/video/fbdev/au1100fb.c b/drivers/video/fbdev/au1100fb.c
index cae17d02d804..1e5b872f0da6 100644
--- a/drivers/video/fbdev/au1100fb.c
+++ b/drivers/video/fbdev/au1100fb.c
@@ -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;
 
-- 
2.15.0

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

From: SF Markus Elfring <hidden>
Date: 2017-11-27 18:01:55

From: Markus Elfring <redacted>
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.

Signed-off-by: Markus Elfring <redacted>
---
 drivers/video/fbdev/au1100fb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/video/fbdev/au1100fb.c b/drivers/video/fbdev/au1100fb.c
index 1e5b872f0da6..7c9a672e9811 100644
--- a/drivers/video/fbdev/au1100fb.c
+++ b/drivers/video/fbdev/au1100fb.c
@@ -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;
-- 
2.15.0

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

From: Bartlomiej Zolnierkiewicz <hidden>
Date: 2018-03-28 14:25:23

On Monday, November 27, 2017 06:58:22 PM SF Markus Elfring wrote:
From: Markus Elfring <redacted>
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.

Signed-off-by: Markus Elfring <redacted>
Patch queued for 4.17, thanks.

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

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

From: Bartlomiej Zolnierkiewicz <hidden>
Date: 2018-03-28 14:27:09

On Monday, November 27, 2017 06:59:57 PM SF Markus Elfring wrote:
From: Markus Elfring <redacted>
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.

Signed-off-by: Markus Elfring <redacted>
Patch queued for 4.17, thanks.

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

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

From: Bartlomiej Zolnierkiewicz <hidden>
Date: 2018-03-28 14:29:06

On Monday, November 27, 2017 07:01:14 PM SF Markus Elfring wrote:
From: Markus Elfring <redacted>
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.

Signed-off-by: Markus Elfring <redacted>
Patch queued for 4.17, thanks.

Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R&D Institute Poland
Samsung Electronics
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help