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


Groups > linux.kernel > #1694775 > unrolled thread

[PATCH 2/4] gpio: tegra: Prefer kcalloc() over kzalloc() with multiplies

Started byThierry Reding <thierry.reding@gmail.com>
First post2017-07-24 17:00 +0200
Last post2017-07-25 10:30 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 2/4] gpio: tegra: Prefer kcalloc() over kzalloc() with multiplies Thierry Reding <thierry.reding@gmail.com> - 2017-07-24 17:00 +0200
    Re: [PATCH 2/4] gpio: tegra: Prefer kcalloc() over kzalloc() with  multiplies Jon Hunter <jonathanh@nvidia.com> - 2017-07-25 10:30 +0200

#1694775 — [PATCH 2/4] gpio: tegra: Prefer kcalloc() over kzalloc() with multiplies

FromThierry Reding <thierry.reding@gmail.com>
Date2017-07-24 17:00 +0200
Subject[PATCH 2/4] gpio: tegra: Prefer kcalloc() over kzalloc() with multiplies
Message-ID<u6MZX-6gF-1@gated-at.bofh.it>
From: Thierry Reding <treding@nvidia.com>

Rather than manually compute the size of an array, pass the number and
element size to kcalloc().

Signed-off-by: Thierry Reding <treding@nvidia.com>
---
 drivers/gpio/gpio-tegra.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpio/gpio-tegra.c b/drivers/gpio/gpio-tegra.c
index 63ee221f9be9..1d4df290d7ab 100644
--- a/drivers/gpio/gpio-tegra.c
+++ b/drivers/gpio/gpio-tegra.c
@@ -621,10 +621,10 @@ static int tegra_gpio_probe(struct platform_device *pdev)
 	if (tgi->soc->debounce_supported)
 		tgi->gc.set_config = tegra_gpio_set_config;
 
-	tgi->bank_info = devm_kzalloc(&pdev->dev, tgi->bank_count *
+	tgi->bank_info = devm_kcalloc(&pdev->dev, tgi->bank_count,
 				      sizeof(*tgi->bank_info), GFP_KERNEL);
 	if (!tgi->bank_info)
-		return -ENODEV;
+		return -ENOMEM;
 
 	tgi->irq_domain = irq_domain_add_linear(pdev->dev.of_node,
 						tgi->gc.ngpio,
-- 
2.13.3

[toc] | [next] | [standalone]


#1695488 — Re: [PATCH 2/4] gpio: tegra: Prefer kcalloc() over kzalloc() with multiplies

FromJon Hunter <jonathanh@nvidia.com>
Date2017-07-25 10:30 +0200
SubjectRe: [PATCH 2/4] gpio: tegra: Prefer kcalloc() over kzalloc() with multiplies
Message-ID<u73o6-oR-17@gated-at.bofh.it>
In reply to#1694775

On 24/07/17 15:55, Thierry Reding wrote:
> From: Thierry Reding <treding@nvidia.com>
> 
> Rather than manually compute the size of an array, pass the number and
> element size to kcalloc().
> 
> Signed-off-by: Thierry Reding <treding@nvidia.com>
> ---
>  drivers/gpio/gpio-tegra.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpio/gpio-tegra.c b/drivers/gpio/gpio-tegra.c
> index 63ee221f9be9..1d4df290d7ab 100644
> --- a/drivers/gpio/gpio-tegra.c
> +++ b/drivers/gpio/gpio-tegra.c
> @@ -621,10 +621,10 @@ static int tegra_gpio_probe(struct platform_device *pdev)
>  	if (tgi->soc->debounce_supported)
>  		tgi->gc.set_config = tegra_gpio_set_config;
>  
> -	tgi->bank_info = devm_kzalloc(&pdev->dev, tgi->bank_count *
> +	tgi->bank_info = devm_kcalloc(&pdev->dev, tgi->bank_count,
>  				      sizeof(*tgi->bank_info), GFP_KERNEL);
>  	if (!tgi->bank_info)
> -		return -ENODEV;
> +		return -ENOMEM;
>  
>  	tgi->irq_domain = irq_domain_add_linear(pdev->dev.of_node,
>  						tgi->gc.ngpio,
> 

Acked-by: Jon Hunter <jonathanh@nvidia.com>

Cheers
Jon

-- 
nvpublic

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web