Re: [PATCH 1/1] power: check return value of devm_kzalloc

From: Pali RohÃr
Date: Sun Apr 23 2017 - 15:45:25 EST


On Sunday 23 April 2017 11:03:56 Pan Bian wrote:
> pdata = devm_kzalloc(&pdev->dev,
> sizeof(struct isp1704_charger_data), GFP_KERNEL);
> + if (!pdata)
> + return -ENOMEM;
> pdata->enable_gpio = gpio;
>
> dev_info(&pdev->dev, "init gpio %d\n", pdata->enable_gpio);

What about calling "goto fail0", so there will be error message about
failure of registering isp1704 like for any other failures?

--
Pali RohÃr
pali.rohar@xxxxxxxxx

Attachment: signature.asc
Description: This is a digitally signed message part.