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
Unknown Object (File)
Sun, Apr 5, 5:46 PM
Unknown Object (File)
Sat, Apr 4, 3:32 PM
Unknown Object (File)
Sat, Apr 4, 9:50 AM
Unknown Object (File)
Sat, Apr 4, 7:32 AM
Unknown Object (File)
Sat, Apr 4, 4:52 AM
Unknown Object (File)
Fri, Apr 3, 10:44 PM
Unknown Object (File)
Tue, Mar 31, 12:42 PM
Unknown Object (File)
Mon, Mar 30, 10:58 PM
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