[PATCH 0/3] video/fbdev/omap: Adjustments for two function implementations

STALE3026d

5 messages, 2 authors, 2018-04-26 · open the first message on its own page

[PATCH 0/3] video/fbdev/omap: Adjustments for two function implementations

From: SF Markus Elfring <hidden>
Date: 2017-11-26 17:40:38

From: Markus Elfring <redacted>
Date: Sun, 26 Nov 2017 18:38:48 +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 in omapfb_do_probe()
  Improve a size determination in omapfb_do_probe()
  Delete an error message for a failed memory allocation in mipid_spi_probe()

 drivers/video/fbdev/omap/lcd_mipid.c   | 4 +---
 drivers/video/fbdev/omap/omapfb_main.c | 4 +---
 2 files changed, 2 insertions(+), 6 deletions(-)

-- 
2.15.0

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

From: SF Markus Elfring <hidden>
Date: 2017-11-26 17:41:48

From: Markus Elfring <redacted>
Date: Sun, 26 Nov 2017 18:09:15 +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/omap/omapfb_main.c | 2 --
 1 file changed, 2 deletions(-)
diff --git a/drivers/video/fbdev/omap/omapfb_main.c b/drivers/video/fbdev/omap/omapfb_main.c
index 3479a47a3082..b0d91524bf6c 100644
--- a/drivers/video/fbdev/omap/omapfb_main.c
+++ b/drivers/video/fbdev/omap/omapfb_main.c
@@ -1647,8 +1647,6 @@ static int omapfb_do_probe(struct platform_device *pdev,
 
 	fbdev = kzalloc(sizeof(struct omapfb_device), GFP_KERNEL);
 	if (fbdev = NULL) {
-		dev_err(&pdev->dev,
-			"unable to allocate memory for device info\n");
 		r = -ENOMEM;
 		goto cleanup;
 	}
-- 
2.15.0

[PATCH 2/3] video: omap: Improve a size determination in omapfb_do_probe()

From: SF Markus Elfring <hidden>
Date: 2017-11-26 17:42:37

From: Markus Elfring <redacted>
Date: Sun, 26 Nov 2017 18:16:20 +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/omap/omapfb_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/video/fbdev/omap/omapfb_main.c b/drivers/video/fbdev/omap/omapfb_main.c
index b0d91524bf6c..c47059430ca8 100644
--- a/drivers/video/fbdev/omap/omapfb_main.c
+++ b/drivers/video/fbdev/omap/omapfb_main.c
@@ -1645,7 +1645,7 @@ static int omapfb_do_probe(struct platform_device *pdev,
 		goto cleanup;
 	}
 
-	fbdev = kzalloc(sizeof(struct omapfb_device), GFP_KERNEL);
+	fbdev = kzalloc(sizeof(*fbdev), GFP_KERNEL);
 	if (fbdev = NULL) {
 		r = -ENOMEM;
 		goto cleanup;
-- 
2.15.0

[PATCH 3/3] video: omap: Delete an error message for a failed memory allocation in mipid_spi_probe()

From: SF Markus Elfring <hidden>
Date: 2017-11-26 17:43:52

From: Markus Elfring <redacted>
Date: Sun, 26 Nov 2017 18:21:25 +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/omap/lcd_mipid.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/video/fbdev/omap/lcd_mipid.c b/drivers/video/fbdev/omap/lcd_mipid.c
index e3a85432f926..e71b674b47d8 100644
--- a/drivers/video/fbdev/omap/lcd_mipid.c
+++ b/drivers/video/fbdev/omap/lcd_mipid.c
@@ -564,10 +564,8 @@ static int mipid_spi_probe(struct spi_device *spi)
 	int r;
 
 	md = kzalloc(sizeof(*md), GFP_KERNEL);
-	if (md = NULL) {
-		dev_err(&spi->dev, "out of memory\n");
+	if (!md)
 		return -ENOMEM;
-	}
 
 	spi->mode = SPI_MODE_0;
 	md->spi = spi;
-- 
2.15.0

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

From: Bartlomiej Zolnierkiewicz <hidden>
Date: 2018-04-26 10:23:05

On Sunday, November 26, 2017 06:42:23 PM SF Markus Elfring wrote:
From: Markus Elfring <redacted>
Date: Sun, 26 Nov 2017 18:16:20 +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.18, 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