linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] staging/iio: Use correct argument for sizeof
@ 2013-01-21 21:14 Peter Huewe
  2013-01-22  6:43 ` Dan Carpenter
  2013-01-22 11:58 ` Jonathan Cameron
  0 siblings, 2 replies; 6+ messages in thread
From: Peter Huewe @ 2013-01-21 21:14 UTC (permalink / raw)
  To: Jonathan Cameron
  Cc: Greg Kroah-Hartman, linux-iio, devel, linux-kernel, Peter Huewe

found with coccicheck
sizeof when applied to a pointer typed expression gives the size of
the pointer

The semantic patch that makes this output is available
in scripts/coccinelle/misc/noderef.cocci.

More information about semantic patching is available at
http://coccinelle.lip6.fr/

Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
---
 drivers/staging/iio/iio_hwmon.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/staging/iio/iio_hwmon.c b/drivers/staging/iio/iio_hwmon.c
index c7a5f97..97ad645 100644
--- a/drivers/staging/iio/iio_hwmon.c
+++ b/drivers/staging/iio/iio_hwmon.c
@@ -93,7 +93,7 @@ static int iio_hwmon_probe(struct platform_device *pdev)
 	while (st->channels[st->num_channels].indio_dev)
 		st->num_channels++;
 
-	st->attrs = kzalloc(sizeof(st->attrs) * (st->num_channels + 1),
+	st->attrs = kzalloc(sizeof(*st->attrs) * (st->num_channels + 1),
 			    GFP_KERNEL);
 	if (st->attrs == NULL) {
 		ret = -ENOMEM;
-- 
1.7.8.6


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2013-01-22 11:58 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-21 21:14 [PATCH] staging/iio: Use correct argument for sizeof Peter Huewe
2013-01-22  6:43 ` Dan Carpenter
2013-01-22  7:02   ` Dan Carpenter
2013-01-22  8:02   ` Lars-Peter Clausen
2013-01-22  8:05     ` Dan Carpenter
2013-01-22 11:58 ` Jonathan Cameron

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).