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)
Sat, Jan 25, 8:01 AM
Unknown Object (File)
Fri, Jan 17, 6:07 PM
Unknown Object (File)
Oct 18 2024, 11:00 PM
Unknown Object (File)
Oct 17 2024, 8:50 AM
Unknown Object (File)
Oct 5 2024, 1:28 AM
Unknown Object (File)
Oct 2 2024, 7:56 AM
Unknown Object (File)
Sep 21 2024, 5:28 AM
Unknown Object (File)
Sep 19 2024, 9:07 PM
Subscribers

Details

Summary

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

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 45672
Build 42560: arc lint + arc unit

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
566

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.