Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1269789 > unrolled thread

[PATCH] IIO: adc: at91_adc.c Prefer kmalloc_array over kmalloc with multiply

Started byNizam Haider <nizamhaider786@gmail.com>
First post2015-11-16 01:10 +0100
Last post2015-11-22 13:10 +0100
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] IIO: adc: at91_adc.c Prefer kmalloc_array over kmalloc with multiply Nizam Haider <nizamhaider786@gmail.com> - 2015-11-16 01:10 +0100
    Re: [PATCH] IIO: adc: at91_adc.c Prefer kmalloc_array over kmalloc  with multiply Jonathan Cameron <jic23@kernel.org> - 2015-11-22 13:10 +0100

#1269789 — [PATCH] IIO: adc: at91_adc.c Prefer kmalloc_array over kmalloc with multiply

FromNizam Haider <nizamhaider786@gmail.com>
Date2015-11-16 01:10 +0100
Subject[PATCH] IIO: adc: at91_adc.c Prefer kmalloc_array over kmalloc with multiply
Message-ID<qvfwR-8t5-5@gated-at.bofh.it>
So this patch swaps that use out for kmalloc_array instead.

Signed-off-by Nizam Haider <nijamh@cdac.in>
---
 drivers/iio/adc/at91_adc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iio/adc/at91_adc.c b/drivers/iio/adc/at91_adc.c
index 7b40925..f284cd6 100644
--- a/drivers/iio/adc/at91_adc.c
+++ b/drivers/iio/adc/at91_adc.c
@@ -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;
 
-- 
1.8.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1274855 — Re: [PATCH] IIO: adc: at91_adc.c Prefer kmalloc_array over kmalloc with multiply

FromJonathan Cameron <jic23@kernel.org>
Date2015-11-22 13:10 +0100
SubjectRe: [PATCH] IIO: adc: at91_adc.c Prefer kmalloc_array over kmalloc with multiply
Message-ID<qxBCW-3xG-11@gated-at.bofh.it>
In reply to#1269789
On 16/11/15 00:05, Nizam Haider wrote:
> So this patch swaps that use out for kmalloc_array instead.
> 
> Signed-off-by Nizam Haider <nijamh@cdac.in>
Applied to the togreg branch of iio.git - initially push out as staging
Thanks,

Jonathan
> ---
>  drivers/iio/adc/at91_adc.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/iio/adc/at91_adc.c b/drivers/iio/adc/at91_adc.c
> index 7b40925..f284cd6 100644
> --- a/drivers/iio/adc/at91_adc.c
> +++ b/drivers/iio/adc/at91_adc.c
> @@ -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;
>  
> 

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web