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

Leo Yan leo.yan at arm.com
Thu Jul 9 08:24:10 PDT 2026


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 at arm.com>



More information about the linux-arm-kernel mailing list