Re: [PATCH 1/2] PCI: endpoint: Improve pci_epf_type_add_cfs()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, May 15, 2023 at 02:14:59PM +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(-EINVAL)
> error return.
> 

Shouldn't the error code be -ENODEV?

- Mani

> Signed-off-by: Damien Le Moal <dlemoal@xxxxxxxxxx>
> ---
>  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..d8a6abe2c31c 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(-EINVAL);
>  	}
>  
>  	if (!epf->driver->ops->add_cfs)
> -- 
> 2.40.1
> 

-- 
மணிவண்ணன் சதாசிவம்



[Index of Archives]     [DMA Engine]     [Linux Coverity]     [Linux USB]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Greybus]

  Powered by Linux