Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1729227 > unrolled thread

[PATCH 2/3] [media] fsl-viu: Improve two size determinations in viu_of_probe()

Started bySF Markus Elfring <elfring@users.sourceforge.net>
First post2017-09-08 21:50 +0200
Last post2017-09-08 21:50 +0200
Articles 1 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 2/3] [media] fsl-viu: Improve two size determinations in  viu_of_probe() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-09-08 21:50 +0200

#1729227 — [PATCH 2/3] [media] fsl-viu: Improve two size determinations in viu_of_probe()

FromSF Markus Elfring <elfring@users.sourceforge.net>
Date2017-09-08 21:50 +0200
Subject[PATCH 2/3] [media] fsl-viu: Improve two size determinations in viu_of_probe()
Message-ID<unxrQ-36G-3@gated-at.bofh.it>
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Fri, 8 Sep 2017 21:12:52 +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 <elfring@users.sourceforge.net>
---
 drivers/media/platform/fsl-viu.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/media/platform/fsl-viu.c b/drivers/media/platform/fsl-viu.c
index 526f80649864..1fe2a295db93 100644
--- a/drivers/media/platform/fsl-viu.c
+++ b/drivers/media/platform/fsl-viu.c
@@ -1421,5 +1421,5 @@ static int viu_of_probe(struct platform_device *op)
 	}
 
 	/* remap registers */
-	viu_regs = devm_ioremap(&op->dev, r.start, sizeof(struct viu_reg));
+	viu_regs = devm_ioremap(&op->dev, r.start, sizeof(*viu_regs));
 	if (!viu_regs) {
@@ -1429,5 +1429,5 @@ static int viu_of_probe(struct platform_device *op)
 	}
 
 	/* Prepare our private structure */
-	viu_dev = devm_kzalloc(&op->dev, sizeof(struct viu_dev), GFP_ATOMIC);
+	viu_dev = devm_kzalloc(&op->dev, sizeof(*viu_dev), GFP_ATOMIC);
 	if (!viu_dev) {
-- 
2.14.1

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web