summary refs log tree commit diff
path: root/drivers/xen/xen-pciback
diff options
context:
space:
mode:
authorJuergen Gross <jgross@suse.com>2016-10-31 14:58:41 +0100
committerJuergen Gross <jgross@suse.com>2016-11-07 13:55:34 +0100
commit4e81f1caa7ff77f7fd31bd31f84b1a0dcfc8184e (patch)
tree8d0deb9c42e7411034b940f31e06b4b8c2310023 /drivers/xen/xen-pciback
parenteaf46e181ec3cc3b6eafdbe8e30fb5a03ebbde68 (diff)
downloadlinux-4e81f1caa7ff77f7fd31bd31f84b1a0dcfc8184e.tar.gz
xen: make use of xenbus_read_unsigned() in xen-pciback
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>
Diffstat (limited to 'drivers/xen/xen-pciback')
-rw-r--r--drivers/xen/xen-pciback/xenbus.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/drivers/xen/xen-pciback/xenbus.c b/drivers/xen/xen-pciback/xenbus.c
index 5ce878c51d03..3f0aee0a068b 100644
--- a/drivers/xen/xen-pciback/xenbus.c
+++ b/drivers/xen/xen-pciback/xenbus.c
@@ -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: