diff options
author | Damien Le Moal <dlemoal@kernel.org> | 2023-05-15 09:43:47 +0200 |
---|---|---|
committer | Bjorn Helgaas <bhelgaas@google.com> | 2023-06-23 22:04:36 +0200 |
commit | b6a6e0331fad61e38316a00e14ef6381d9f03161 (patch) | |
tree | 80b168f0da837df2ab7a0dfbcbdface36bfa23bd /drivers/pci | |
parent | PCI: endpoint: functions/pci-epf-test: Fix dma_chan direction (diff) | |
download | linux-b6a6e0331fad61e38316a00e14ef6381d9f03161.tar.xz linux-b6a6e0331fad61e38316a00e14ef6381d9f03161.zip |
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>
Diffstat (limited to 'drivers/pci')
-rw-r--r-- | drivers/pci/endpoint/pci-ep-cfs.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/pci/endpoint/pci-ep-cfs.c b/drivers/pci/endpoint/pci-ep-cfs.c index cd99ac8c3794..18e061af1d8e 100644 --- a/drivers/pci/endpoint/pci-ep-cfs.c +++ b/drivers/pci/endpoint/pci-ep-cfs.c @@ -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) |