[PATCH 0/2] video: ssd1307fb: Adjustments for ssd1307fb_probe()

STALE3057d

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

[PATCH 0/2] video: ssd1307fb: Adjustments for ssd1307fb_probe()

From: SF Markus Elfring <hidden>
Date: 2017-11-25 16:04:37

From: Markus Elfring <redacted>
Date: Sat, 25 Nov 2017 16:56:46 +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/ssd1307fb.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

-- 
2.15.0

[PATCH 1/2] video: ssd1307fb: Delete an error message for a failed memory allocation in ssd1307fb_probe()

From: SF Markus Elfring <hidden>
Date: 2017-11-25 16:05:48

From: Markus Elfring <redacted>
Date: Sat, 25 Nov 2017 16:45:56 +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/ssd1307fb.c | 1 -
 1 file changed, 1 deletion(-)
diff --git a/drivers/video/fbdev/ssd1307fb.c b/drivers/video/fbdev/ssd1307fb.c
index f599520374dd..fb0ef1922d49 100644
--- a/drivers/video/fbdev/ssd1307fb.c
+++ b/drivers/video/fbdev/ssd1307fb.c
@@ -630,7 +630,6 @@ static int ssd1307fb_probe(struct i2c_client *client,
 
 	ssd1307fb_defio = devm_kzalloc(&client->dev, sizeof(struct fb_deferred_io), GFP_KERNEL);
 	if (!ssd1307fb_defio) {
-		dev_err(&client->dev, "Couldn't allocate deferred io.\n");
 		ret = -ENOMEM;
 		goto fb_alloc_error;
 	}
-- 
2.15.0

[PATCH 2/2] video: ssd1307fb: Improve a size determination in ssd1307fb_probe()

From: SF Markus Elfring <hidden>
Date: 2017-11-25 16:07:12

From: Markus Elfring <redacted>
Date: Sat, 25 Nov 2017 16:50:26 +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/ssd1307fb.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/video/fbdev/ssd1307fb.c b/drivers/video/fbdev/ssd1307fb.c
index fb0ef1922d49..bb32b2dd1f7a 100644
--- a/drivers/video/fbdev/ssd1307fb.c
+++ b/drivers/video/fbdev/ssd1307fb.c
@@ -628,7 +628,8 @@ static int ssd1307fb_probe(struct i2c_client *client,
 		goto fb_alloc_error;
 	}
 
-	ssd1307fb_defio = devm_kzalloc(&client->dev, sizeof(struct fb_deferred_io), GFP_KERNEL);
+	ssd1307fb_defio = devm_kzalloc(&client->dev, sizeof(*ssd1307fb_defio),
+				       GFP_KERNEL);
 	if (!ssd1307fb_defio) {
 		ret = -ENOMEM;
 		goto fb_alloc_error;
-- 
2.15.0

Re: [PATCH 0/2] video: ssd1307fb: Adjustments for ssd1307fb_probe()

From: Bartlomiej Zolnierkiewicz <hidden>
Date: 2017-12-29 18:10:30

On Saturday, November 25, 2017 05:04:02 PM SF Markus Elfring wrote:
From: Markus Elfring <redacted>
Date: Sat, 25 Nov 2017 16:56:46 +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
This patch removes the information about the device for which the allocation
fails.
  Improve a size determination
This patch depends on the earlier patch (which is not being merged) so please
re-base it if you want it to be applied.

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

Re: [0/2] video: ssd1307fb: Adjustments for ssd1307fb_probe()

From: SF Markus Elfring <hidden>
Date: 2017-12-29 18:23:59

quoted
  Delete an error message for a failed memory allocation
This patch removes the information about the device for which the allocation fails.
How do you think about to take another look if a Linux allocation failure report
could be sufficient in this use case?

quoted
  Improve a size determination
This patch depends on the earlier patch (which is not being merged)
Partly, yes.

so please re-base it if you want it to be applied.
Would you dare to reduce any context lines for this update step so that
such a small adjustment will still work?

Regards,
Markus

[PATCH v2] video: ssd1307fb: Improve a size determination in ssd1307fb_probe()

From: SF Markus Elfring <hidden>
Date: 2018-01-07 18:35:04

From: Markus Elfring <redacted>
Date: Sun, 7 Jan 2018 19:27:28 +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>
---

v2:
This update suggestion was rebased on source files from the software
"Linux next-20180105".

 drivers/video/fbdev/ssd1307fb.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/video/fbdev/ssd1307fb.c b/drivers/video/fbdev/ssd1307fb.c
index f599520374dd..6439231f2db2 100644
--- a/drivers/video/fbdev/ssd1307fb.c
+++ b/drivers/video/fbdev/ssd1307fb.c
@@ -628,7 +628,8 @@ static int ssd1307fb_probe(struct i2c_client *client,
 		goto fb_alloc_error;
 	}
 
-	ssd1307fb_defio = devm_kzalloc(&client->dev, sizeof(struct fb_deferred_io), GFP_KERNEL);
+	ssd1307fb_defio = devm_kzalloc(&client->dev, sizeof(*ssd1307fb_defio),
+				       GFP_KERNEL);
 	if (!ssd1307fb_defio) {
 		dev_err(&client->dev, "Couldn't allocate deferred io.\n");
 		ret = -ENOMEM;
-- 
2.15.1

Re: [PATCH v2] video: ssd1307fb: Improve a size determination in ssd1307fb_probe()

From: Bartlomiej Zolnierkiewicz <hidden>
Date: 2018-03-28 13:53:46

On Sunday, January 07, 2018 07:34:44 PM SF Markus Elfring wrote:
From: Markus Elfring <redacted>
Date: Sun, 7 Jan 2018 19:27:28 +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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help