HomeFreeBSD

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

Description

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

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
Reviewed by: dumbbell
Differential Revision: https://reviews.freebsd.org/D50154

(cherry picked from commit 96e86aa6faa6fde4ff75fd757db55afe9e4be132)

Details

Provenance
bzAuthored on May 4 2025, 7:58 PM
Reviewer
dumbbell
Differential Revision
D50154: LinuxKPI: pci: deal with kobject_add() being able to fail
Parents
rG1fcc3d6dd5c5: bnxt: add guards around struct_group macros
Branches
Unknown
Tags
Unknown