All of lore.kernel.org
 help / color / mirror / Atom feed
From: SF Markus Elfring <elfring@users.sourceforge.net>
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 2/4] ARM: OMAP: Improve a size determination in two functions
Date: Tue, 03 Oct 2017 20:14:20 +0000	[thread overview]
Message-ID: <8735e7ee-a744-cda4-005b-7a32075655a5@users.sourceforge.net> (raw)
In-Reply-To: <b196ffac-4bd1-4465-cee9-e46b7405633d@users.sourceforge.net>

From: Markus Elfring <elfring@users.sourceforge.net>
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 <elfring@users.sourceforge.net>
---
 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


WARNING: multiple messages have this Message-ID (diff)
From: SF Markus Elfring <elfring@users.sourceforge.net>
To: linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	Aaro Koskinen <aaro.koskinen@iki.fi>,
	Russell King <linux@armlinux.org.uk>,
	Tony Lindgren <tony@atomide.com>
Cc: LKML <linux-kernel@vger.kernel.org>, kernel-janitors@vger.kernel.org
Subject: [PATCH 2/4] ARM: OMAP: Improve a size determination in two functions
Date: Tue, 3 Oct 2017 22:14:20 +0200	[thread overview]
Message-ID: <8735e7ee-a744-cda4-005b-7a32075655a5@users.sourceforge.net> (raw)
In-Reply-To: <b196ffac-4bd1-4465-cee9-e46b7405633d@users.sourceforge.net>

From: Markus Elfring <elfring@users.sourceforge.net>
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 <elfring@users.sourceforge.net>
---
 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

WARNING: multiple messages have this Message-ID (diff)
From: elfring@users.sourceforge.net (SF Markus Elfring)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 2/4] ARM: OMAP: Improve a size determination in two functions
Date: Tue, 3 Oct 2017 22:14:20 +0200	[thread overview]
Message-ID: <8735e7ee-a744-cda4-005b-7a32075655a5@users.sourceforge.net> (raw)
In-Reply-To: <b196ffac-4bd1-4465-cee9-e46b7405633d@users.sourceforge.net>

From: Markus Elfring <elfring@users.sourceforge.net>
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 <elfring@users.sourceforge.net>
---
 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

  parent reply	other threads:[~2017-10-03 20:14 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-03 20:12 [PATCH 0/4] ARM-OMAP: Adjustments for three function implementations SF Markus Elfring
2017-10-03 20:12 ` SF Markus Elfring
2017-10-03 20:12 ` SF Markus Elfring
2017-10-03 20:13 ` [PATCH 1/4] ARM: OMAP: Delete an error message for a failed memory allocation in two functions SF Markus Elfring
2017-10-03 20:13   ` SF Markus Elfring
2017-10-03 20:13   ` SF Markus Elfring
2017-10-03 20:13   ` SF Markus Elfring
2017-10-03 20:14 ` SF Markus Elfring [this message]
2017-10-03 20:14   ` [PATCH 2/4] ARM: OMAP: Improve a size determination " SF Markus Elfring
2017-10-03 20:14   ` SF Markus Elfring
2017-10-03 20:15 ` [PATCH 3/4] ARM: OMAP: Use kcalloc() in omap_system_dma_probe() SF Markus Elfring
2017-10-03 20:15   ` SF Markus Elfring
2017-10-03 20:15   ` SF Markus Elfring
2017-10-03 20:15   ` SF Markus Elfring
2017-10-03 20:16 ` [PATCH 4/4] ARM: OMAP: Fix typos in two comment lines in _omap_dm_timer_request() SF Markus Elfring
2017-10-03 20:16   ` SF Markus Elfring
2017-10-03 20:16   ` SF Markus Elfring
2017-10-03 20:16   ` SF Markus Elfring
2017-10-11 18:20 ` [PATCH 0/4] ARM-OMAP: Adjustments for three function implementations Tony Lindgren
2017-10-11 18:20   ` Tony Lindgren
2017-10-11 18:20   ` Tony Lindgren

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8735e7ee-a744-cda4-005b-7a32075655a5@users.sourceforge.net \
    --to=elfring@users.sourceforge.net \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.