linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jon Hunter <jonathanh-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
To: Thierry Reding
	<thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	Linus Walleij
	<linus.walleij-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
Cc: linux-gpio-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH 2/4] gpio: tegra: Prefer kcalloc() over kzalloc() with multiplies
Date: Tue, 25 Jul 2017 09:27:19 +0100	[thread overview]
Message-ID: <c89d51ec-18dc-f5ee-f899-09a0480b56e6@nvidia.com> (raw)
In-Reply-To: <20170724145508.7388-2-thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>



On 24/07/17 15:55, Thierry Reding wrote:
> From: Thierry Reding <treding-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
> 
> Rather than manually compute the size of an array, pass the number and
> element size to kcalloc().
> 
> Signed-off-by: Thierry Reding <treding-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
> ---
>  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-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>

Cheers
Jon

-- 
nvpublic

  parent reply	other threads:[~2017-07-25  8:27 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-24 14:55 [PATCH 1/4] gpio: tegra: Remove unnecessary check Thierry Reding
2017-07-24 14:55 ` [PATCH 2/4] gpio: tegra: Prefer kcalloc() over kzalloc() with multiplies Thierry Reding
     [not found]   ` <20170724145508.7388-2-thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-07-25  8:27     ` Jon Hunter [this message]
2017-08-02 12:16     ` Linus Walleij
2017-07-24 14:55 ` [PATCH 4/4] gpio: tegra: Use unsigned int where possible Thierry Reding
2017-07-25  9:16   ` Jon Hunter
     [not found] ` <20170724145508.7388-1-thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-07-24 14:55   ` [PATCH 3/4] gpio: tegra: Fix checkpatch warnings Thierry Reding
2017-07-25  8:30     ` Jon Hunter
     [not found]     ` <20170724145508.7388-3-thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-08-02 12:18       ` Linus Walleij
2017-07-25  8:27   ` [PATCH 1/4] gpio: tegra: Remove unnecessary check Jon Hunter
2017-07-31 11:00 ` Thierry Reding
2017-08-02 12:15 ` Linus Walleij

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c89d51ec-18dc-f5ee-f899-09a0480b56e6@nvidia.com \
    --to=jonathanh-ddmlm1+adcrqt0dzr+alfa@public.gmane.org \
    --cc=linus.walleij-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
    --cc=linux-gpio-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).