From: Thierry Reding <thierry.reding@gmail.com>
To: Linus Walleij <linus.walleij@linaro.org>
Cc: Jonathan Hunter <jonathanh@nvidia.com>,
linux-gpio@vger.kernel.org, linux-tegra@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: [PATCH 2/4] gpio: tegra: Prefer kcalloc() over kzalloc() with multiplies
Date: Mon, 24 Jul 2017 16:55:06 +0200 [thread overview]
Message-ID: <20170724145508.7388-2-thierry.reding@gmail.com> (raw)
In-Reply-To: <20170724145508.7388-1-thierry.reding@gmail.com>
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
next prev parent reply other threads:[~2017-07-24 14:55 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 ` Thierry Reding [this message]
[not found] ` <20170724145508.7388-2-thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-07-25 8:27 ` [PATCH 2/4] gpio: tegra: Prefer kcalloc() over kzalloc() with multiplies Jon Hunter
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=20170724145508.7388-2-thierry.reding@gmail.com \
--to=thierry.reding@gmail.com \
--cc=jonathanh@nvidia.com \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tegra@vger.kernel.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).