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


Groups > linux.kernel > #1633832

[PATCH 2/3] soc-knav_dma: Improve a size determination in knav_dma_probe()

From SF Markus Elfring <elfring@users.sourceforge.net>
Newsgroups linux.kernel
Subject [PATCH 2/3] soc-knav_dma: Improve a size determination in knav_dma_probe()
Date 2017-05-01 21:40 +0200
Message-ID <tCpkS-4KF-27@gated-at.bofh.it> (permalink)
References <tCpbc-4FA-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


From: Markus Elfring <elfring@users.sourceforge.net>
Date: Mon, 1 May 2017 21:06:46 +0200

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.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/soc/ti/knav_dma.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/soc/ti/knav_dma.c b/drivers/soc/ti/knav_dma.c
index a66671a93199..410018d9054e 100644
--- a/drivers/soc/ti/knav_dma.c
+++ b/drivers/soc/ti/knav_dma.c
@@ -739,8 +739,7 @@ static int knav_dma_probe(struct platform_device *pdev)
 		return -EINVAL;
 	}
 
-	kdev = devm_kzalloc(dev,
-			sizeof(struct knav_dma_pool_device), GFP_KERNEL);
+	kdev = devm_kzalloc(dev, sizeof(*kdev), GFP_KERNEL);
 	if (!kdev) {
 		dev_err(dev, "could not allocate driver mem\n");
 		return -ENOMEM;
-- 
2.12.2

Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

[PATCH 0/3] SoC-TI-knav_dma: Fine-tuning for three function  implementations SF Markus Elfring <elfring@users.sourceforge.net> - 2017-05-01 21:30 +0200
  [PATCH 3/3] soc-knav_dma: Delete error messages for a failed memory  allocation in two functions SF Markus Elfring <elfring@users.sourceforge.net> - 2017-05-01 21:40 +0200
  [PATCH 2/3] soc-knav_dma: Improve a size determination in  knav_dma_probe() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-05-01 21:40 +0200

csiph-web