Re: [PATCH v2 1/2] coresight: Fix clock refcount imbalance on platform remove
From: Jie Gan
Date: Fri Jul 10 2026 - 04:09:16 EST
On 7/9/2026 11:24 PM, Leo Yan wrote:
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:
Fixed and sent new version.
Thanks,
Jie
Reviewed-by: Leo Yan <leo.yan@xxxxxxx>