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

On Saturday, November 25, 2017 05:04:02 PM SF Markus Elfring wrote:
> 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

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


2017-12-29 18:23:59

by SF Markus Elfring

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

>> 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?


>> 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

2018-01-07 18:35:04

by SF Markus Elfring

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

From: 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.

Signed-off-by: Markus Elfring <[email protected]>
---

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

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

On Sunday, January 07, 2018 07:34:44 PM SF Markus Elfring wrote:
> From: 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.
>
> Signed-off-by: Markus Elfring <[email protected]>

Patch queued for 4.17, thanks.

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