Skip to content

Commit b6a6e03

Browse files
damien-lemoalbjorn-helgaas
authored andcommitted
PCI: endpoint: Improve pci_epf_type_add_cfs()
pci_epf_type_add_cfs() should not be called with an unbound EPF device, that is, an epf device with epf->driver not set. For such case, replace the NULL return in pci_epf_type_add_cfs() with a clear ERR_PTR(-ENODEV) pointer error return. Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Damien Le Moal <[email protected]> Signed-off-by: Lorenzo Pieralisi <[email protected]> Signed-off-by: Bjorn Helgaas <[email protected]> Reviewed-by: Manivannan Sadhasivami <[email protected]>
1 parent 880d51c commit b6a6e03

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/pci/endpoint/pci-ep-cfs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -532,7 +532,7 @@ static struct config_group *pci_epf_type_add_cfs(struct pci_epf *epf,
532532

533533
if (!epf->driver) {
534534
dev_err(&epf->dev, "epf device not bound to driver\n");
535-
return NULL;
535+
return ERR_PTR(-ENODEV);
536536
}
537537

538538
if (!epf->driver->ops->add_cfs)

0 commit comments

Comments
 (0)