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-pcifront

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>

+2 -4
+2 -4
drivers/pci/xen-pcifront.c
··· 1038 1038 err = -ENOMEM; 1039 1039 goto out; 1040 1040 } 1041 - err = xenbus_scanf(XBT_NIL, pdev->xdev->otherend, str, "%d", 1042 - &state); 1043 - if (err != 1) 1044 - state = XenbusStateUnknown; 1041 + state = xenbus_read_unsigned(pdev->xdev->otherend, str, 1042 + XenbusStateUnknown); 1045 1043 1046 1044 if (state != XenbusStateClosing) 1047 1045 continue;