Re: [PATCH] usb: xhci: check Null pointer in segment alloc

Michal Pecio
2025-12-23T19:44:05Z

On Tue, 23 Dec 2025 13:37:41 -0500, Alan Stern wrote:
> > So in the light of your explanation, the fact that xhci_resume()
> > sets HW_ACCESSIBLE before actually completing resume and thus
> > allows root hub resume to pretend to work, is obviously a bug.
>
> No, not really. The proper time to set HW_ACCESSIBLE is when it
> becomes possible to do I/O to the HC's registers, i.e., when the
> controller changes from D3 to D0 (and maybe a few other things like
> pci_set_master() have been done). By the time xhci_resume() gets
> called this should already have happened, so setting the flag
> immediately is the right thing for it to do.

OK, so no problem here, thanks.

> Agreed, we can't do anything without more and better logs. Adding
> dev_info() lines to the start and end of the various xhci-hcd suspend
> and resume routines, as well as xhci_mem_cleanup() and
> xhci_mem_init() and whatever else you can think of, would be a good
> start.

That code is packed with dev_dbg(), so seeing this reproduced with
dynamic debug enabled would be a good start. It was the first thing
I suggested before trying to find problems with USB or xHCI code.

Regards,
Michal