Page MenuHomeFreeBSD

bhyve: Return void from pci_emul_alloc_bar
AcceptedPublic

Authored by jhb on Fri, Jul 31, 5:46 PM.
Tags
None
Referenced Files
F165039246: D58579.id183172.diff
Wed, Aug 5, 11:42 AM
F164987546: D58579.diff
Wed, Aug 5, 5:53 AM
F164939223: D58579.diff
Wed, Aug 5, 12:33 AM
Unknown Object (File)
Tue, Aug 4, 5:49 AM
Unknown Object (File)
Mon, Aug 3, 2:42 AM
Unknown Object (File)
Fri, Jul 31, 7:44 PM

Details

Reviewers
markj
bnovkov
chuck
Group Reviewers
bhyve
Summary

This function never fails.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 75323
Build 72206: arc lint + arc unit

Event Timeline

jhb requested review of this revision.Fri, Jul 31, 5:46 PM
usr.sbin/bhyve/pci_emul.c
802

Alternatively, we could make all these assert()'s instead return an error. I add some more assertions in subsequent changes, so turning these into errors would be ok instead if we preferred that.

markj added inline comments.
usr.sbin/bhyve/pci_emul.c
802

I like using assertions if we're really sure the asserted condition really is always true. If an error can happen with certain combinations of parameters and not others, I prefer to have separate functions which return a value, or not, depending on whether an error can occur.

828

This could fail, but the only reasonable thing to do here is err() anyway.

This revision is now accepted and ready to land.Fri, Jul 31, 7:46 PM
usr.sbin/bhyve/pci_emul.c
802

These are generally all assertions (as well as ones I add in future changes) that indicate programmer errors passing in invalid constants (and not user-supplied input), so assertions is probably fine.