Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

+3 -5
+3 -5
drivers/xen/xen-pciback/xenbus.c
··· 362 362 int err = 0; 363 363 int num_devs; 364 364 int domain, bus, slot, func; 365 - int substate; 365 + unsigned int substate; 366 366 int i, len; 367 367 char state_str[64]; 368 368 char dev_str[64]; ··· 395 395 "configuration"); 396 396 goto out; 397 397 } 398 - err = xenbus_scanf(XBT_NIL, pdev->xdev->nodename, state_str, 399 - "%d", &substate); 400 - if (err != 1) 401 - substate = XenbusStateUnknown; 398 + substate = xenbus_read_unsigned(pdev->xdev->nodename, state_str, 399 + XenbusStateUnknown); 402 400 403 401 switch (substate) { 404 402 case XenbusStateInitialising: