]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
xen: make use of xenbus_read_unsigned() in xen-pcifront
authorJuergen Gross <jgross@suse.com>
Mon, 31 Oct 2016 13:58:41 +0000 (14:58 +0100)
committerBoris Ostrovsky <boris.ostrovsky@oracle.com>
Fri, 3 Feb 2017 20:55:28 +0000 (15:55 -0500)
Use xenbus_read_unsigned() instead of xenbus_scanf() when possible.
This requires to change the type of the read from int to unsigned,
but this case has been wrong before: negative values are not allowed
for the modified case.

Cc: bhelgaas@google.com
Cc: linux-pci@vger.kernel.org
Signed-off-by: Juergen Gross <jgross@suse.com>
Acked-by: Bjorn Helgaas <bhelgaas@google.com>
Acked-by: David Vrabel <david.vrabel@citrix.com>
OraBug: 25497392

(cherry picked from commit 58faf07b76817782ea20c392639569ea613cd439)
Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
drivers/pci/xen-pcifront.c

index 4f5bdcada351edbd4aa6751120373982a0ef5a64..76ea0feb40bebc6fa3622db37f5ac800958364b5 100644 (file)
@@ -1028,10 +1028,8 @@ static int pcifront_detach_devices(struct pcifront_device *pdev)
                        err = -ENOMEM;
                        goto out;
                }
-               err = xenbus_scanf(XBT_NIL, pdev->xdev->otherend, str, "%d",
-                                  &state);
-               if (err != 1)
-                       state = XenbusStateUnknown;
+               state = xenbus_read_unsigned(pdev->xdev->otherend, str,
+                                            XenbusStateUnknown);
 
                if (state != XenbusStateClosing)
                        continue;