Re: [PATCH 1/1] gpio: add a driver for the Synopsys DesignWare APB GPIO block

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

 



On Wed, Nov 6, 2013 at 5:09 PM, Fabio Estevam <festevam@xxxxxxxxx> wrote:
> On Wed, Nov 6, 2013 at 8:49 PM, Alan Tull <delicious.quinoa@xxxxxxxxx> wrote:
>
>> +
>> +       res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>> +       gpio->regs = devm_ioremap_resource(&pdev->dev, res);
>> +       if (!gpio->regs) {
>> +               err = -ENOMEM;
>> +               goto out_free_ports;
>
> The correct way to handle the error here would be:
>
> if (IS_ERR(gpio->regs) {
>      err = PTR_ERR(gpio->regs)
>      goto out_free_ports;
>
>
>> +out_unregister:
>> +       dwapb_gpio_unregister(gpio);
>> +
>> +       if (gpio->domain) {
>> +               irq_dispose_mapping(gpio->hwirq);
>> +               irq_domain_remove(gpio->domain);
>> +       }
>> +
>> +out_free_ports:
>> +       devm_kfree(&pdev->dev, gpio->ports);
>
> No need to call devm_kfree
>
>> +
>> +out_err:
>> +       devm_kfree(&pdev->dev, gpio);
>
> Same here.
>
>> +       return err;
>> +}
>> +
>> +static int dwapb_gpio_remove(struct platform_device *pdev)
>> +{
>> +       struct dwapb_gpio *gpio = platform_get_drvdata(pdev);
>> +
>> +       dwapb_gpio_unregister(gpio);
>> +       if (gpio->domain) {
>> +               irq_dispose_mapping(gpio->hwirq);
>> +               irq_domain_remove(gpio->domain);
>> +       }
>> +       devm_kfree(&pdev->dev, gpio->ports);
>> +       devm_kfree(&pdev->dev, gpio);
>
> No need to call devm_kfree
>
> Regards,
>
> Fabio Estevam

Cool, I agree.  I will fix in v7.

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




[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux