tech-kern archive

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

Re: ehci: fix error handling?



Le 25/05/2019 à 08:53, Iain Hibbert a écrit :
On Sat, 25 May 2019, Maxime Villard wrote:

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?

the latter

It looks like there is no clean way to handle attach failures.

attach always 'succeeds' in the sense that after attach has been called,
detach will always be called. The detach routine should tear down
everything that needs tearing down and not do things that will fail.
Perhaps the init could simply be done before the attach routine gets the
chance to fail?

iain

Ok, thanks, I've fixed it and the machine shuts down correctly now.

However there seem to be other problems in the attach/detach. ehci_init()
and ehci_detach() are not symmetrical, the former initializes more stuff
than the latter deinitializes. ehci_pci.c deinitializes the extra stuff
correctly, but the others (cardbus, arm, mips) don't.


Home | Main Index | Thread Index | Old Index