IIO: adc: at91_adc.c Prefer kmalloc_array over kmalloc with multiply
authorNizam Haider <nizamhaider786@gmail.com>
Mon, 16 Nov 2015 00:05:57 +0000 (05:35 +0530)
committerJonathan Cameron <jic23@kernel.org>
Sun, 22 Nov 2015 12:06:19 +0000 (12:06 +0000)
So this patch swaps that use out for kmalloc_array instead.

Signed-off-by Nizam Haider <nijamh@cdac.in>

Signed-off-by: Jonathan Cameron <jic23@kernel.org>
drivers/iio/adc/at91_adc.c

index 7b40925..f284cd6 100644 (file)
@@ -742,7 +742,7 @@ static int at91_adc_of_get_resolution(struct at91_adc_state *st,
                return count;
        }
 
-       resolutions = kmalloc(count * sizeof(*resolutions), GFP_KERNEL);
+       resolutions = kmalloc_array(count, sizeof(*resolutions), GFP_KERNEL);
        if (!resolutions)
                return -ENOMEM;