Re: [PATCH] usb: hub: Set proper message when usb_hub_create_port_device() fails

From: Andy Shevchenko

Date: Mon Aug 10 2026 - 12:38:26 EST


On Tue, Jul 28, 2026 at 06:00:04PM +0800, Chen-Yu Tsai wrote:
> Right now when usb_hub_create_port_device() fails, it prints a separate
> error message to say which port failed, but otherwise leaves 'message'
> set to the default "out of memory", which is somewhat misleading.
>
> Allocate some memory and put the currently separate error message in
> it, and use it as the error message. If the allocation fails, use a
> generic version of the error message. The allocation uses devres
> helpers, and will be freed after the message is printed and the device
> is cleaned up.

The 'message' is local to the function, why devm?
Shouldn't __free() be sufficient?

--
With Best Regards,
Andy Shevchenko