Thread (6 messages) flat view 6 messages, 2 authors, 2017-10-11
STALE3260d

[PATCH 2/4] ARM: OMAP: Improve a size determination in two functions

From: SF Markus Elfring <hidden>
Date: 2017-10-03 20:14:58
Also in: kernel-janitors, linux-omap, lkml
Subsystem: arm port, the rest · Maintainers: Russell King, Linus Torvalds

From: Markus Elfring <redacted>
Date: Tue, 3 Oct 2017 20:46:48 +0200

Replace the specification of data structures by pointer dereferences
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>
---
 arch/arm/plat-omap/dma.c     | 2 +-
 arch/arm/plat-omap/dmtimer.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/arm/plat-omap/dma.c b/arch/arm/plat-omap/dma.c
index 6ede0427548c..409e4ecaebe9 100644
--- a/arch/arm/plat-omap/dma.c
+++ b/arch/arm/plat-omap/dma.c
@@ -1316,7 +1316,7 @@ static int omap_system_dma_probe(struct platform_device *pdev)
 	enable_1510_mode	= d->dev_caps & ENABLE_1510_MODE;
 
 	dma_chan = devm_kcalloc(&pdev->dev, dma_lch_count,
-				sizeof(struct omap_dma_lch), GFP_KERNEL);
+				sizeof(*dma_chan), GFP_KERNEL);
 	if (!dma_chan)
 		return -ENOMEM;
 
diff --git a/arch/arm/plat-omap/dmtimer.c b/arch/arm/plat-omap/dmtimer.c
index 446ac0e3a35a..14779d6f425d 100644
--- a/arch/arm/plat-omap/dmtimer.c
+++ b/arch/arm/plat-omap/dmtimer.c
@@ -857,7 +857,7 @@ static int omap_dm_timer_probe(struct platform_device *pdev)
 		return -ENODEV;
 	}
 
-	timer = devm_kzalloc(dev, sizeof(struct omap_dm_timer), GFP_KERNEL);
+	timer = devm_kzalloc(dev, sizeof(*timer), GFP_KERNEL);
 	if (!timer)
 		return  -ENOMEM;
 
-- 
2.14.2
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help