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

From: Andy Shevchenko

Date: Mon Oct 12 2026 - 16:53:15 EST


On Mon, Oct 12, 2026 at 05:27:24PM +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.
>
> Set |message| to an error message that is more specific to this error
> path instead of using the default "out of memory" message.

...

> if (ret < 0) {
> dev_err(hub->intfdev,
> "couldn't create port%d device.\n", i + 1);
> + message = "couldn't create port device";
> break;

We can now even use

message = "couldn't create port device";
dev_err(hub->intfdev, "%s %d.\n", message, + 1);

> }

--
With Best Regards,
Andy Shevchenko