Page MenuHomeFreeBSD

Clean up in the pci host generic driver
ClosedPublic

Authored by andrew on May 23 2022, 1:32 PM.
Tags
None
Referenced Files
Unknown Object (File)
Feb 9 2024, 5:46 AM
Unknown Object (File)
Dec 22 2023, 11:09 PM
Unknown Object (File)
Dec 18 2023, 3:31 PM
Unknown Object (File)
Dec 12 2023, 3:22 PM
Unknown Object (File)
Aug 31 2023, 10:14 PM
Unknown Object (File)
Aug 29 2023, 9:47 AM
Unknown Object (File)
Aug 26 2023, 2:58 PM
Unknown Object (File)
Aug 26 2023, 2:56 PM
Subscribers

Details

Summary

Add clean up on failure and a detach function to the pci host generic
driver.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

sys/dev/pci/pci_host_generic.c
169

Is there any reason that you went with this style over what other drivers do with testing pointers, etc in a generic release routine?

sys/dev/pci/pci_host_generic.c
169

rman_fini is dangerous as it locks rm->rm_mtx. This is allocated via malloc so may be a NULL pointer dereference if rman_init hasn't been called. We could check on rm->rm_mtx, but that feels like it's too much knowledge of the internals that may change.

jhb added a subscriber: jhb.
jhb added inline comments.
sys/dev/pci/pci_host_generic.c
571–573

Given that this driver has no probe method, I assume it's used as a base class for other drivers and not instantiated directly. In that case, are these attach/detach methods ever used or do child classes always define custom methods that call these routines? (For example, I see now calls to bus_generic_attach or bus_generic_detach, so it seems unlikely these routines can be used for attach/detach as-is). If they are always used in custom methods, I think it makes sense to not define device_attach and device_detach in this method list at all.

This revision is now accepted and ready to land.May 27 2022, 4:33 PM
This revision was automatically updated to reflect the committed changes.