]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
xen: make use of xenbus_read_unsigned() in xen-pciback
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:29 +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.

Signed-off-by: Juergen Gross <jgross@suse.com>
Acked-by: David Vrabel <david.vrabel@citrix.com>
OraBug: 25497392

(cherry picked from commit 4e81f1caa7ff77f7fd31bd31f84b1a0dcfc8184e)
Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
drivers/xen/xen-pciback/xenbus.c

index 0a04e76de585f0e9fe33e0a4905fac91f229f0f0..db082125b79daf6a48b529bbb9f7fa321ea143ea 100644 (file)
@@ -362,7 +362,7 @@ static int xen_pcibk_reconfigure(struct xen_pcibk_device *pdev)
        int err = 0;
        int num_devs;
        int domain, bus, slot, func;
-       int substate;
+       unsigned int substate;
        int i, len;
        char state_str[64];
        char dev_str[64];
@@ -395,10 +395,8 @@ static int xen_pcibk_reconfigure(struct xen_pcibk_device *pdev)
                                         "configuration");
                        goto out;
                }
-               err = xenbus_scanf(XBT_NIL, pdev->xdev->nodename, state_str,
-                                  "%d", &substate);
-               if (err != 1)
-                       substate = XenbusStateUnknown;
+               substate = xenbus_read_unsigned(pdev->xdev->nodename, state_str,
+                                               XenbusStateUnknown);
 
                switch (substate) {
                case XenbusStateInitialising: