Re: [PATCH v2 4/5] virpci: Don't error on not binded devices

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

 



On Thu, Oct 31, 2013 at 11:23:41AM +0000, Michal Privoznik wrote:

s/not binded/unbinded/ in $SUBJ

> If a PCI deivce is not binded to any driver (e.g. there's yet no PCI
> driver in the linux kernel) but still users want to passthru the device
> we fail the whole operation as we fail to resolve the 'driver' link
> under the PCI device sysfs tree. Obviously, this is not a fatal error
> and it shouldn't be error at all.
> 
> Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx>
> ---
>  src/util/virpci.c | 12 +++++++++---
>  1 file changed, 9 insertions(+), 3 deletions(-)
> 
> diff --git a/src/util/virpci.c b/src/util/virpci.c
> index 65d7168..0727085 100644
> --- a/src/util/virpci.c
> +++ b/src/util/virpci.c
> @@ -1095,10 +1095,16 @@ virPCIDeviceBindToStub(virPCIDevicePtr dev,
>      const char *newDriverName = NULL;
>  
>      if (virPCIDriverDir(&stubDriverPath, stubDriverName) < 0 ||
> -        virPCIFile(&driverLink, dev->name, "driver") < 0 ||
> -        virPCIDeviceGetDriverPathAndName(dev, &oldDriverPath,
> -                                         &oldDriverName) < 0) {
> +        virPCIFile(&driverLink, dev->name, "driver") < 0)
>          goto cleanup;
> +
> +    if (virPCIDeviceGetDriverPathAndName(dev, &oldDriverPath,
> +                                         &oldDriverName) < 0) {
> +        /* It's okay if device is not binded to any driver. If that's the case,
> +         * there's no /sys/bus/pci/devices/.../driver symlink. */
> +        if (errno != ENOENT)
> +            goto cleanup;
> +        virResetLastError();
>      }
>  
>      if (virFileExists(driverLink)) {
> -- 
> 1.8.1.5
> 

If you don't use the result of this function, you don't need to call
it at all, because there is no code utilizing those
oldDriver{Path,Name} variables.

ACK if you remove the call to the function completely.

Martin

Attachment: signature.asc
Description: Digital signature

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]