diff options
author | Axel Lin <axel.lin@ingics.com> | 2012-10-29 04:25:00 -0400 |
---|---|---|
committer | Jonathan Cameron <jic23@kernel.org> | 2012-10-31 06:56:28 -0400 |
commit | 6b3aa3131a7804640e7589e5629036f660362f0b (patch) | |
tree | 3aa72aabc60c2143926e51aeb84dd3e9b8d42d9e /drivers/iio | |
parent | 2b0c856ad9571013db8fc369194b7108dff3c18e (diff) |
Revert "iio: at91_adc: Use devm_kcalloc to allocate arrays"
This reverts commit 45259859492812c8b700ae1d157be01a8d2babfe.
This fixes build error because devm_kcalloc does not exist in current tree.
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Diffstat (limited to 'drivers/iio')
-rw-r--r-- | drivers/iio/adc/at91_adc.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/drivers/iio/adc/at91_adc.c b/drivers/iio/adc/at91_adc.c index a9176722042f..2e2c9a80aa37 100644 --- a/drivers/iio/adc/at91_adc.c +++ b/drivers/iio/adc/at91_adc.c | |||
@@ -123,8 +123,10 @@ static int at91_adc_channel_init(struct iio_dev *idev) | |||
123 | idev->num_channels = bitmap_weight(&st->channels_mask, | 123 | idev->num_channels = bitmap_weight(&st->channels_mask, |
124 | st->num_channels) + 1; | 124 | st->num_channels) + 1; |
125 | 125 | ||
126 | chan_array = devm_kcalloc(&idev->dev, idev->num_channels + 1, | 126 | chan_array = devm_kzalloc(&idev->dev, |
127 | sizeof(*chan_array), GFP_KERNEL); | 127 | ((idev->num_channels + 1) * |
128 | sizeof(struct iio_chan_spec)), | ||
129 | GFP_KERNEL); | ||
128 | 130 | ||
129 | if (!chan_array) | 131 | if (!chan_array) |
130 | return -ENOMEM; | 132 | return -ENOMEM; |
@@ -268,8 +270,9 @@ static int at91_adc_trigger_init(struct iio_dev *idev) | |||
268 | struct at91_adc_state *st = iio_priv(idev); | 270 | struct at91_adc_state *st = iio_priv(idev); |
269 | int i, ret; | 271 | int i, ret; |
270 | 272 | ||
271 | st->trig = devm_kcalloc(&idev->dev, st->trigger_number, | 273 | st->trig = devm_kzalloc(&idev->dev, |
272 | sizeof(*st->trig), GFP_KERNEL); | 274 | st->trigger_number * sizeof(st->trig), |
275 | GFP_KERNEL); | ||
273 | 276 | ||
274 | if (st->trig == NULL) { | 277 | if (st->trig == NULL) { |
275 | ret = -ENOMEM; | 278 | ret = -ENOMEM; |
@@ -451,8 +454,9 @@ static int at91_adc_probe_dt(struct at91_adc_state *st, | |||
451 | st->registers->trigger_register = prop; | 454 | st->registers->trigger_register = prop; |
452 | 455 | ||
453 | st->trigger_number = of_get_child_count(node); | 456 | st->trigger_number = of_get_child_count(node); |
454 | st->trigger_list = devm_kcalloc(&idev->dev, st->trigger_number, | 457 | st->trigger_list = devm_kzalloc(&idev->dev, st->trigger_number * |
455 | sizeof(*st->trigger_list), GFP_KERNEL); | 458 | sizeof(struct at91_adc_trigger), |
459 | GFP_KERNEL); | ||
456 | if (!st->trigger_list) { | 460 | if (!st->trigger_list) { |
457 | dev_err(&idev->dev, "Could not allocate trigger list memory.\n"); | 461 | dev_err(&idev->dev, "Could not allocate trigger list memory.\n"); |
458 | ret = -ENOMEM; | 462 | ret = -ENOMEM; |