tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

ehci: fix error handling?



Recent Lenovo machines have a Realtek USB 1.1 controller with EHCI. NetBSD
tries to attach it in dev/pci/ehci_pci.c::ehci_pci_attach(), and does goto
fail with "pre-2.0 USB rev".

The thing is, the device remains registered. When I try to shut down the
machine, ehci_pci_detach() gets called and crashes, because we didn't
completely initialize 'sc' in ehci_pci_attach(). In particular, it triggers
a KASSERT in callout_halt(), because callout_init() was not called before.

To fix this problem, we need to fix the error handling in ehci_pci_attach(),
so that goto fail does not leave 'sc' in an inconsistent state.

What is the best way to do that? Should I somehow forcibly unregister the
device, or should I add a flag in 'sc' to indicate whether it is initialized?
It looks like there is no clean way to handle attach failures.

Currently it is impossible to cleanly shut down or reboot this machine.


Home | Main Index | Thread Index | Old Index