On Mon, May 11, 2026 at 05:04:44PM +0800, Jie Gan wrote:
In coresight_enable_sysfs(), for non-CPU sources (SOFTWARE, TPDM, OTHERS), the source device is enabled via coresight_enable_source_sysfs() before idr_alloc_u32() maps the path. If idr_alloc_u32() fails, the original code jumped directly to err_source, which only calls coresight_disable_path() and coresight_release_path(). The source device was left enabled with an incremented refcnt but no path tracked for it, leaving the device in an inconsistent state.
Disable the source before jumping to err_source so the enable and path operations are fully unwound.
Fixes: 1f5149c7751c ("coresight: Move all sysfs code to sysfs file") Signed-off-by: Jie Gan quic_jiegan@quicinc.com
Actually I have noticed this. Since my PM series will remove IDR things, and I don't think anyone really hit idr alloc error, this is why I didn't send fix for this.
Anyway, this is a reasonable fix. I will send out my PM series later in today, I will pick this patch into my series and rebase on it, hope this is easier for all of us.
Thanks, Leo