Re: [PATCH 1/2] gpio: brcmstb: Handle return value of devm_kasprintf

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Sep 20, 2017 at 12:13 AM, Arvind Yadav
<arvind.yadav.cs@xxxxxxxxx> wrote:
> devm_kasprintf() can fail here and we must check its return value.
>
> Signed-off-by: Arvind Yadav <arvind.yadav.cs@xxxxxxxxx>
> ---
>  drivers/gpio/gpio-brcmstb.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/drivers/gpio/gpio-brcmstb.c b/drivers/gpio/gpio-brcmstb.c
> index dd0308c..1227d6e 100644
> --- a/drivers/gpio/gpio-brcmstb.c
> +++ b/drivers/gpio/gpio-brcmstb.c
> @@ -485,6 +485,9 @@ static int brcmstb_gpio_probe(struct platform_device *pdev)
>                 gc->of_node = np;
>                 gc->owner = THIS_MODULE;
>                 gc->label = devm_kasprintf(dev, GFP_KERNEL, "%pOF", dev->of_node);
> +               if (!gc->label)
> +                       goto fail;

Please also set err to -ENOMEM.

> +
>                 gc->base = gpio_base;
>                 gc->of_gpio_n_cells = 2;
>                 gc->of_xlate = brcmstb_gpio_of_xlate;
> --
> 1.9.1
>

Thanks,
Gregory
--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux SPI]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux