Re: [PATCH] power: 88pm860x_battery: Add a few more devm_* APIs

From: Anton Vorontsov
Date: Sat Jan 05 2013 - 21:40:54 EST


On Fri, Nov 23, 2012 at 06:11:52PM +0530, Tushar Behera wrote:
> Add devm_* APIs for threaded IRQ.
>
> Also since devres managed objects are removed when the device gets
> detached, remove explicit freeing of them.
>
> Signed-off-by: Tushar Behera <tushar.behera@xxxxxxxxxx>
> ---
[...]
> @@ -994,9 +988,6 @@ static int __devexit pm860x_battery_remove(struct platform_device *pdev)
> struct pm860x_battery_info *info = platform_get_drvdata(pdev);
>
> power_supply_unregister(&info->battery);
> - free_irq(info->irq_batt, info);
> - free_irq(info->irq_cc, info);
> - kfree(info);

It is not safe to access battery ('struct power_supply') object after
_unregister() (and irq handlers will surely do). Instead of removing
free_irq(), you should place the two calls before _unregister().

Thanks,

> platform_set_drvdata(pdev, NULL);
> return 0;
> }
> --
> 1.7.4.1
--
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/