Re: [PATCH v3] counter: ti-eqep: use devm for runtime PM to fix probe error path
From: William Breathitt Gray
Date: Wed Jun 03 2026 - 22:22:19 EST
On Fri, May 29, 2026 at 02:58:34PM +0500, Stepan Ionichev wrote:
> err = counter_add(counter);
> - if (err < 0) {
> - pm_runtime_put_sync(dev);
> - pm_runtime_disable(dev);
> - return err;
> - }
> + if (err < 0)
> + return dev_err_probe(dev, err, "Failed to add counter\n");
>
> return 0;
> }
> @@ -564,11 +575,8 @@ static int ti_eqep_probe(struct platform_device *pdev)
> static void ti_eqep_remove(struct platform_device *pdev)
> {
> struct counter_device *counter = platform_get_drvdata(pdev);
> - struct device *dev = &pdev->dev;
>
> counter_unregister(counter);
> - pm_runtime_put_sync(dev);
> - pm_runtime_disable(dev);
> }
The ti_eqep_remove() callback can go away entirely if you use
devm_counter_add() to replace counter_add(). It's not really part of
this PM fix, but it is a nice clean up to simplify the code if you would
like to add a subsequent patch doing so after the PM fix.
William Breathitt Gray