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/20230515074348.595704-2-dlemoal@kernel.org Signed-off-by: Damien Le Moal <dlemoal@kernel.org> Signed-off-by: Lorenzo Pieralisi <lpieralisi@kernel.org> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> Reviewed-by: Manivannan Sadhasivami <manivannan.sadhasivam@linaro.org>
1 parent 880d51c commit b6a6e03

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

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)