Re: [PATCH] drivers/mtd/devices/spear_smi.c: use devm_ functionsconsistently

From: Stefan Roese
Date: Fri Aug 24 2012 - 09:20:39 EST


On 08/24/2012 01:35 PM, Artem Bityutskiy wrote:
>> @@ -1073,21 +1043,13 @@ static int __devexit spear_smi_remove(struct platform_device *pdev)
>> ret = mtd_device_unregister(&flash->mtd);
>> if (ret)
>> dev_err(&pdev->dev, "error removing mtd\n");
>> -
>> - iounmap(flash->base_addr);
>> - kfree(flash);
>> }
>>
>> irq = platform_get_irq(pdev, 0);
>> - free_irq(irq, dev);
>
> I guess 'platform_get_irq()' should be killed as well? Stefan, this is
> strange code - we get irq, without checking for error, and then free it?
> What is the rationale?

Yes, this seems bogus. platform_get_irq() definitely should be removed
from spear_smi_remove().

>> clk_disable_unprepare(dev->clk);
>> - clk_put(dev->clk);
>> - iounmap(dev->io_base);
>> - kfree(dev);
>>
>> smi_base = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>> - release_mem_region(smi_base->start, resource_size(smi_base));
>> platform_set_drvdata(pdev, NULL);
>
> Why do we set platform data to NULL, is this needed?

It seems to be common practice to use this call to clear the drvdata in
the driver remove function. I have to admit, that I'm not sure if its
really needed though.

Thanks,
Stefan
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/