Commit b6a6e033 authored by Damien Le Moal's avatar Damien Le Moal Committed by Bjorn Helgaas
Browse files

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: default avatarDamien Le Moal <dlemoal@kernel.org>
Signed-off-by: default avatarLorenzo Pieralisi <lpieralisi@kernel.org>
Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
Reviewed-by: default avatarManivannan Sadhasivami <manivannan.sadhasivam@linaro.org>
parent 880d51c7
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -532,7 +532,7 @@ static struct config_group *pci_epf_type_add_cfs(struct pci_epf *epf,

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

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