video: ssd1307fb: Adjustments for ssd1307fb_probe()
Subsystems (2)
cover video: ssd1307fb: Adjustments for ssd1307fb_probe()
From: Markus Elfring <[email protected]>
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(-)
Signature · 1 line
2.15.0
PATCH 1/2 video: ssd1307fb: Delete an error message for a failed memory allocation in ssd1307fb_probe()
From: Markus Elfring <[email protected]>
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.
--- drivers/video/fbdev/ssd1307fb.c | 1 - 1 file changed, 1 deletion(-)
drivers/video/fbdev/ssd1307fb.c +0 -1
@@ -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; }
Signature · 1 line
2.15.0
PATCH 2/2 video: ssd1307fb: Improve a size determination in ssd1307fb_probe()
In reply to SF Markus ElfringFrom: Markus Elfring <[email protected]>
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.
--- drivers/video/fbdev/ssd1307fb.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/video/fbdev/ssd1307fb.c +2 -1
@@ -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;
Signature · 1 line
2.15.0
Quoted 8 lines · SF Markus Elfring
From: Markus Elfring <[email protected]>
Date: Sat, 25 Nov 2017 16:56:46 +0100Two 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.
Quoted 1 line
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
Quoted 3 lines
Quoted 1 line
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 3 lines
Quoted 1 line
Improve a size determination
This patch depends on the earlier patch (which is not being merged)
Partly, yes.
Quoted 1 line
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 1/1 video: ssd1307fb: Improve a size determination in ssd1307fb_probe()
In reply to Bartlomiej ZolnierkiewiczFrom: Markus Elfring <[email protected]>
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.
---
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(-)
drivers/video/fbdev/ssd1307fb.c +2 -1
@@ -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 ;
Signature · 1 line
2.15.1
Re: [PATCH v2] video: ssd1307fb: Improve a size determination in ssd1307fb_probe()
Quoted 10 lines · SF Markus Elfring
From: Markus Elfring <[email protected]>
Date: Sun, 7 Jan 2018 19:27:28 +0100Replace 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 <[email protected]>
Patch queued for 4.17, thanks.
Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R&D Institute Poland
Samsung Electronics