Re: [PATCH v2 1/2] coresight: Fix clock refcount imbalance on platform remove

From: Leo Yan

Date: Thu Jul 09 2026 - 11:30:43 EST


On Thu, Jul 02, 2026 at 04:54:19PM +0800, Jie Gan wrote:

[...]

> static void etm4_remove_platform_dev(struct platform_device *pdev)
> {
> struct etmv4_drvdata *drvdata = dev_get_drvdata(&pdev->dev);
>
> if (drvdata)
> etm4_remove_dev(drvdata);

I understood this is not an issue caused by this patch, could you refine
a bit as blow so can be consistent:

if (WARN_ON(!drvdata))
return;

> + /*
> + * Resume the device so its clocks are enabled again, balancing the
> + * clk_disable_unprepare() that devm runs when the driver detaches.
> + * Then mark it suspended and drop the usage count taken here.
> + */
> + pm_runtime_get_sync(&pdev->dev);

etm4_remove_dev(drvdata);

> pm_runtime_disable(&pdev->dev);
> + pm_runtime_set_suspended(&pdev->dev);
> + pm_runtime_put_noidle(&pdev->dev);
> }

With above change:

Reviewed-by: Leo Yan <leo.yan@xxxxxxx>