Page MenuHomeFreeBSD

pciconf: Minor cleanups in the config register methods
ClosedPublic

Authored by jhb on Jun 10 2026, 8:36 PM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Jul 7, 4:10 PM
Unknown Object (File)
Mon, Jul 6, 11:06 AM
Unknown Object (File)
Fri, Jul 3, 11:52 PM
Unknown Object (File)
Tue, Jun 30, 11:04 AM
Unknown Object (File)
Tue, Jun 30, 11:01 AM
Unknown Object (File)
Tue, Jun 30, 11:01 AM
Unknown Object (File)
Tue, Jun 30, 11:00 AM
Unknown Object (File)
Sun, Jun 28, 2:31 PM
Subscribers
None

Details

Summary

This is mostly to provide cleaner code for future changes to copy from
as other changes are already copying somewhat dubious existing
patterns in these routines.

  • Use NULL instead of casting 0 to pointer types.
  • Inline readone() in the sole caller now that it is just a single line.
  • Use a helper variable for the count of items on each line of output in readit().
  • Fix the double space in the middle of byte output to only trigger for width 1. For other widths it would output spurious spaces at the end of the line which doesn't really hurt, but is buggy nonetheless.
  • Avoid using implicit booleans by explicitly comparing integer expressions against zero.
  • Don't compare the endptr returned from strtol() against NULL.

Diff Detail

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

Event Timeline

jhb requested review of this revision.Jun 10 2026, 8:36 PM
jhb created this revision.
This revision was not accepted when it landed; it landed in state Needs Review.Tue, Jun 23, 3:52 PM
This revision was automatically updated to reflect the committed changes.