From: Juergen Gross Date: Mon, 31 Oct 2016 13:58:41 +0000 (+0100) Subject: xen: make use of xenbus_read_unsigned() in xen-pcifront X-Git-Tag: v4.1.12-102.0.20170601_1400~213^2~24^2~23 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=485ca4bfcdf0bc186beea5ae3bdec93881884257;p=users%2Fjedix%2Flinux-maple.git 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 Acked-by: Bjorn Helgaas Acked-by: David Vrabel OraBug: 25497392 (cherry picked from commit 58faf07b76817782ea20c392639569ea613cd439) Signed-off-by: Boris Ostrovsky --- diff --git a/drivers/pci/xen-pcifront.c b/drivers/pci/xen-pcifront.c index 4f5bdcada351e..76ea0feb40beb 100644 --- a/drivers/pci/xen-pcifront.c +++ b/drivers/pci/xen-pcifront.c @@ -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;