Page MenuHomeFreeBSD

LinuxKPI: pci: deal with kobject_add() being able to fail
ClosedPublic

Authored by bz on May 4 2025, 10:04 PM.
Tags
None
Referenced Files
F142161021: D50154.id154810.diff
Fri, Jan 16, 3:09 PM
F142129897: D50154.id155219.diff
Fri, Jan 16, 7:38 AM
Unknown Object (File)
Tue, Jan 6, 7:40 AM
Unknown Object (File)
Thu, Dec 25, 9:31 PM
Unknown Object (File)
Dec 3 2025, 6:39 AM
Unknown Object (File)
Nov 27 2025, 8:53 PM
Unknown Object (File)
Nov 25 2025, 9:08 PM
Unknown Object (File)
Nov 4 2025, 3:06 AM
Subscribers

Details

Summary

lkpifill_pci_dev() uses a sequene of kobject_init/set_name/add.
The problem is that kobject_add could fail.

Move the entire logic to the beginning of the function,
switch to kobject_init_and_add() and check the return code.
Make lkpifill_pci_dev() return the error and deal in the callers
with a possible error accordingly.

Sponsored by: The FreeBSD Foundation
MFC after: 3 days

Diff Detail

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