Message ID | 20230515074348.595704-2-dlemoal@kernel.org |
---|---|
State | New |
Headers | show |
Series | Fixup changes to pci_epf_type_add_cfs() | expand |
On Mon, May 15, 2023 at 04:43:47PM +0900, Damien Le Moal wrote: > 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. > > Signed-off-by: Damien Le Moal <dlemoal@kernel.org> Reviewed-by: Manivannan Sadhasivami <manivannan.sadhasivam@linaro.org> - Mani > --- > drivers/pci/endpoint/pci-ep-cfs.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/pci/endpoint/pci-ep-cfs.c b/drivers/pci/endpoint/pci-ep-cfs.c > index 0fb6c376166f..0bf5be986e9b 100644 > --- a/drivers/pci/endpoint/pci-ep-cfs.c > +++ b/drivers/pci/endpoint/pci-ep-cfs.c > @@ -516,7 +516,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) > -- > 2.40.1 >
diff --git a/drivers/pci/endpoint/pci-ep-cfs.c b/drivers/pci/endpoint/pci-ep-cfs.c index 0fb6c376166f..0bf5be986e9b 100644 --- a/drivers/pci/endpoint/pci-ep-cfs.c +++ b/drivers/pci/endpoint/pci-ep-cfs.c @@ -516,7 +516,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)
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. Signed-off-by: Damien Le Moal <dlemoal@kernel.org> --- drivers/pci/endpoint/pci-ep-cfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)