video: s3c-fb: Adjustments for s3c_fb_probe()

Started by SF Markus Elfring on Nov 26, 2017 · 7 messages from 3 authors · Last reply Mar 28, 2018

Series

2 patches, 1 file

+2 −4

Subsystems (3)

Maintainers (3)

STALE3151d

open the first message on its own page

  1. [PATCH 1/2] video: s3c-fb: Delete an error message for a failed memory allocation in s3c_fb_probe()
    Related patches
  2. [PATCH 2/2] video: s3c-fb: Improve a size determination in s3c_fb_probe()
    Related patches
Message details and related content
From: Markus Elfring <redacted>
Date: Sun, 26 Nov 2017 15:12:34 +0100

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

Markus Elfring (2):
  Delete an error message for a failed memory allocation
  Improve a size determination

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

-- 
2.15.0

[PATCH 1/2] video: s3c-fb: Delete an error message for a failed memory allocation in s3c_fb_probe()

Message details and related content
From: Markus Elfring <redacted>
Date: Sun, 26 Nov 2017 15:00:16 +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/s3c-fb.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/video/fbdev/s3c-fb.c b/drivers/video/fbdev/s3c-fb.c
index 5f4f696c2ecf..0914c973cbd9 100644
--- a/drivers/video/fbdev/s3c-fb.c
+++ b/drivers/video/fbdev/s3c-fb.c
@@ -1384,10 +1384,8 @@ static int s3c_fb_probe(struct platform_device *pdev)
 	}
 
 	sfb = devm_kzalloc(dev, sizeof(struct s3c_fb), GFP_KERNEL);
-	if (!sfb) {
-		dev_err(dev, "no memory for framebuffers\n");
+	if (!sfb)
 		return -ENOMEM;
-	}
 
 	dev_dbg(dev, "allocate new framebuffer %p\n", sfb);
 
-- 
2.15.0

[PATCH 2/2] video: s3c-fb: Improve a size determination in s3c_fb_probe()

Message details and related content
From: Markus Elfring <redacted>
Date: Sun, 26 Nov 2017 15:03:03 +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/s3c-fb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/video/fbdev/s3c-fb.c b/drivers/video/fbdev/s3c-fb.c
index 0914c973cbd9..8c7623d63eb1 100644
--- a/drivers/video/fbdev/s3c-fb.c
+++ b/drivers/video/fbdev/s3c-fb.c
@@ -1383,7 +1383,7 @@ static int s3c_fb_probe(struct platform_device *pdev)
 		return -EINVAL;
 	}
 
-	sfb = devm_kzalloc(dev, sizeof(struct s3c_fb), GFP_KERNEL);
+	sfb = devm_kzalloc(dev, sizeof(*sfb), GFP_KERNEL);
 	if (!sfb)
 		return -ENOMEM;
 
-- 
2.15.0

Re: [PATCH 1/2] video: s3c-fb: Delete an error message for a failed memory allocation in s3c_fb_probe()

Message details and related content
On Sunday, November 26, 2017 9:17 AM, SF Markus Elfring wrote:
From: Markus Elfring <redacted>
Date: Sun, 26 Nov 2017 15:00:16 +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>
Acked-by: Jingoo Han <jingoohan1@gmail.com>

Best regards,
Jingoo Han
quoted hunk
---
 drivers/video/fbdev/s3c-fb.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/video/fbdev/s3c-fb.c b/drivers/video/fbdev/s3c-fb.c
index 5f4f696c2ecf..0914c973cbd9 100644
--- a/drivers/video/fbdev/s3c-fb.c
+++ b/drivers/video/fbdev/s3c-fb.c
@@ -1384,10 +1384,8 @@ static int s3c_fb_probe(struct platform_device
*pdev)
 	}

 	sfb = devm_kzalloc(dev, sizeof(struct s3c_fb), GFP_KERNEL);
-	if (!sfb) {
-		dev_err(dev, "no memory for framebuffers\n");
+	if (!sfb)
 		return -ENOMEM;
-	}

 	dev_dbg(dev, "allocate new framebuffer %p\n", sfb);

--
2.15.0

Re: [PATCH 2/2] video: s3c-fb: Improve a size determination in s3c_fb_probe()

Message details and related content
On Sunday, November 26, 2017 9:18 AM, SF Markus Elfring wrote:
From: Markus Elfring <redacted>
Date: Sun, 26 Nov 2017 15:03:03 +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>
Acked-by: Jingoo Han <jingoohan1@gmail.com>

Best regards,
Jingoo Han
quoted hunk
---
 drivers/video/fbdev/s3c-fb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/video/fbdev/s3c-fb.c b/drivers/video/fbdev/s3c-fb.c
index 0914c973cbd9..8c7623d63eb1 100644
--- a/drivers/video/fbdev/s3c-fb.c
+++ b/drivers/video/fbdev/s3c-fb.c
@@ -1383,7 +1383,7 @@ static int s3c_fb_probe(struct platform_device *pdev)
 		return -EINVAL;
 	}

-	sfb = devm_kzalloc(dev, sizeof(struct s3c_fb), GFP_KERNEL);
+	sfb = devm_kzalloc(dev, sizeof(*sfb), GFP_KERNEL);
 	if (!sfb)
 		return -ENOMEM;

--
2.15.0

Re: [PATCH 1/2] video: s3c-fb: Delete an error message for a failed memory allocation in s3c_fb_probe()

Message details and related content
On Monday, November 27, 2017 01:06:30 PM Jingoo Han wrote:
On Sunday, November 26, 2017 9:17 AM, SF Markus Elfring wrote:
quoted
From: Markus Elfring <redacted>
Date: Sun, 26 Nov 2017 15:00:16 +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>
Acked-by: Jingoo Han <jingoohan1@gmail.com>
Patch queued for 4.17, thanks.

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

Re: [PATCH 2/2] video: s3c-fb: Improve a size determination in s3c_fb_probe()

Message details and related content
On Monday, November 27, 2017 01:07:15 PM Jingoo Han wrote:
On Sunday, November 26, 2017 9:18 AM, SF Markus Elfring wrote:
quoted
From: Markus Elfring <redacted>
Date: Sun, 26 Nov 2017 15:03:03 +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>
Acked-by: Jingoo Han <jingoohan1@gmail.com>
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 / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help