Skip to contentSkip to conversation

staging:iio:dac: Fix kcalloc parameters swapped

PATCH In review Axel Lin 2 participants 2 messages Feb 11, 2012 – Feb 12, 2012

Subsystems (4)
lore
Share & tools
lore

Axel Lin

author
#0 lore raw

PATCH 1/1 staging:iio:dac: Fix kcalloc parameters swapped

The first parameter should be "number of elements" and the second parameter should be "element size".

---
 drivers/staging/iio/dac/ad5360.c |    4 ++--
 drivers/staging/iio/dac/ad5380.c |    4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)
drivers/staging/iio/dac/ad5360.c +2 -2
index 710b256..cec3693 100644
@@ -439,8 +439,8 @@ static int __devinit ad5360_alloc_channels(struct iio_dev *indio_dev)
 	struct iio_chan_spec *channels;
 	unsigned int i;
 
-	channels = kcalloc(sizeof(struct iio_chan_spec),
-			st->chip_info->num_channels, GFP_KERNEL);
+	channels = kcalloc(st->chip_info->num_channels,
+			   sizeof(struct iio_chan_spec), GFP_KERNEL);
 
 	if (!channels)
 		return -ENOMEM;
drivers/staging/iio/dac/ad5380.c +2 -2
index eff97ae0..4c50716 100644
@@ -363,8 +363,8 @@ static int __devinit ad5380_alloc_channels(struct iio_dev *indio_dev)
 	struct iio_chan_spec *channels;
 	unsigned int i;
 
-	channels = kcalloc(sizeof(struct iio_chan_spec),
-			st->chip_info->num_channels, GFP_KERNEL);
+	channels = kcalloc(st->chip_info->num_channels,
+			   sizeof(struct iio_chan_spec), GFP_KERNEL);
 
 	if (!channels)
 		return -ENOMEM;
Signature · 1 line
1.7.5.4
Acked-by on v1 1/1
#1 lore raw
Quoted 4 lines · Axel Lin

The first parameter should be "number of elements" and the second parameter should be "element size".

Quoted 35 lines
---
 drivers/staging/iio/dac/ad5360.c |    4 ++--
 drivers/staging/iio/dac/ad5380.c |    4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)
drivers/staging/iio/dac/ad5360.c +2 -2
index 710b256..cec3693 100644
@@ -439,8 +439,8 @@ static int __devinit ad5360_alloc_channels(struct iio_dev *indio_dev)
 	struct iio_chan_spec *channels;
 	unsigned int i;
 
-	channels = kcalloc(sizeof(struct iio_chan_spec),
-			st->chip_info->num_channels, GFP_KERNEL);
+	channels = kcalloc(st->chip_info->num_channels,
+			   sizeof(struct iio_chan_spec), GFP_KERNEL);
 
 	if (!channels)
 		return -ENOMEM;
drivers/staging/iio/dac/ad5380.c +2 -2
index eff97ae0..4c50716 100644
@@ -363,8 +363,8 @@ static int __devinit ad5380_alloc_channels(struct iio_dev *indio_dev)
 	struct iio_chan_spec *channels;
 	unsigned int i;
 
-	channels = kcalloc(sizeof(struct iio_chan_spec),
-			st->chip_info->num_channels, GFP_KERNEL);
+	channels = kcalloc(st->chip_info->num_channels,
+			   sizeof(struct iio_chan_spec), GFP_KERNEL);
 
 	if (!channels)
 		return -ENOMEM;