Re: [PATCH] i2c: bfin: turn to Resource-managed API in probe function

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

 



Hi Wolfram,

On Wed, May 21, 2014 at 4:05 PM, Wolfram Sang <wsa@xxxxxxxxxxxxx> wrote:
>
>> @@ -646,22 +646,19 @@ static int i2c_bfin_twi_probe(struct platform_device *pdev)
>>       res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>>       if (res == NULL) {
>>               dev_err(&pdev->dev, "Cannot get IORESOURCE_MEM\n");
>> -             rc = -ENOENT;
>> -             goto out_error_get_res;
>> +             return -ENOENT;
>
> You don't need to check the resource. devm_ioremap_resource will do it.

OK

>
>> -     iface->regs_base = ioremap(res->start, resource_size(res));
>> -     if (iface->regs_base == NULL) {
>> +     iface->regs_base = devm_ioremap_resource(&pdev->dev, res);
>> +     if (IS_ERR((void *)iface->regs_base)) {
>>               dev_err(&pdev->dev, "Cannot map IO\n");
>> -             rc = -ENXIO;
>> -             goto out_error_ioremap;
>> +             return PTR_ERR((void *)iface->regs_base);
>
> Do we need the casts?

No. I will remove the cast.

>
>> @@ -740,8 +728,6 @@ static int i2c_bfin_twi_remove(struct platform_device *pdev)
>>       i2c_del_adapter(&(iface->adap));
>>       free_irq(iface->irq, iface);
>>       peripheral_free_list(dev_get_platdata(&pdev->dev));
>> -     iounmap(iface->regs_base);
>> -     kfree(iface);
>
> You missed to remove the free irq.
>
> Have you actually tried unloading the module?
>

Ok. The free_irq should be removed.

I will send a new patch.

Thank you.

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




[Index of Archives]     [Linux GPIO]     [Linux SPI]     [Linux Hardward Monitoring]     [LM Sensors]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux