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

Andy Shevchenko <[email protected]>
Newsgroups org.kernel.vger.linux-usb,org.kernel.vger.linux-kernel
Organization Intel Finland Oy - BIC 0357606-4 - c/o Alberga Business Park, 6 krs, Bertel Jungin Aukio 5, 02600 Espoo
Message-ID <[email protected]>
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.