Re: [PATCH]pci/bus.c: check return value of pci_enable_device()

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

 



Junchang Wang wrote:
> pci_enable_device can fail. In that case, a printed warning would be
> more appropriate.
> 
> Signed-off-by: Justin P. Mattock <justinmattock@xxxxxxxxx>
> Signed-off-by: Junchang Wang <junchangwang@xxxxxxxxx>
> ---
>  drivers/pci/bus.c |    3 +++
>  1 files changed, 3 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/pci/bus.c b/drivers/pci/bus.c
> index 628ea20..4e71777 100644
> --- a/drivers/pci/bus.c
> +++ b/drivers/pci/bus.c
> @@ -240,6 +240,9 @@ void pci_enable_bridges(struct pci_bus *bus)
>  		if (dev->subordinate) {
>  			if (!pci_is_enabled(dev)) {
>  				retval = pci_enable_device(dev);
> +				if (retval)
> +					dev_err(&dev->dev, "Error opening "
> +							"device, continuing\n");
>  				pci_set_master(dev);
>  			}
>  			pci_enable_bridges(dev->subordinate);

In case you print an error message you should really include the error code so 
one can see what actually went wrong.

Eike

Attachment: signature.asc
Description: This is a digitally signed message part.


[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