Re: [PATCH] usb: typec: ucsi: Fix missing typec_unregister_port on error paths

From: Greg Kroah-Hartman
Date: Mon Nov 24 2025 - 07:29:17 EST


On Mon, Nov 24, 2025 at 08:20:30PM +0800, Haotian Zhang wrote:
> The ucsi_register_port() registers a Type-C port with
> typec_register_port(), but several error paths after a successful
> registration returned directly to cleanup without calling
> typec_unregister_port(). This lead to a potential resource leak.
>
> Add a common error-unwind path that calls typec_unregister_port()
> for all failures to ensure proper cleanup.
>
> Fixes: c1b0bc2dabfa ("usb: typec: Add support for UCSI interface")
> Signed-off-by: Haotian Zhang <vulab@xxxxxxxxxxx>

How was this found?

How was this tested?

thanks,

greg k-h