Commit 9b882269 authored by Thierry Reding's avatar Thierry Reding Committed by Linus Walleij

gpio: tegra: Prefer kcalloc() over kzalloc() with multiplies

Rather than manually compute the size of an array, pass the number and
element size to kcalloc().
Signed-off-by: default avatarThierry Reding <treding@nvidia.com>
Acked-by: default avatarJon Hunter <jonathanh@nvidia.com>
Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
parent 20133bd5
...@@ -622,10 +622,10 @@ static int tegra_gpio_probe(struct platform_device *pdev) ...@@ -622,10 +622,10 @@ static int tegra_gpio_probe(struct platform_device *pdev)
if (tgi->soc->debounce_supported) if (tgi->soc->debounce_supported)
tgi->gc.set_config = tegra_gpio_set_config; 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); sizeof(*tgi->bank_info), GFP_KERNEL);
if (!tgi->bank_info) if (!tgi->bank_info)
return -ENODEV; return -ENOMEM;
tgi->irq_domain = irq_domain_add_linear(pdev->dev.of_node, tgi->irq_domain = irq_domain_add_linear(pdev->dev.of_node,
tgi->gc.ngpio, tgi->gc.ngpio,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment