Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S944690AbcJaQuJ (ORCPT ); Mon, 31 Oct 2016 12:50:09 -0400 Received: from mx2.suse.de ([195.135.220.15]:52580 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S944465AbcJaQsz (ORCPT ); Mon, 31 Oct 2016 12:48:55 -0400 From: Juergen Gross To: linux-kernel@vger.kernel.org, xen-devel@lists.xen.org Cc: david.vrabel@citrix.com, boris.ostrovsky@oracle.com, Juergen Gross Subject: [PATCH 11/12] xen: make use of xenbus_read_unsigned() in xen-pciback Date: Mon, 31 Oct 2016 17:48:29 +0100 Message-Id: <1477932510-28594-12-git-send-email-jgross@suse.com> X-Mailer: git-send-email 2.6.6 In-Reply-To: <1477932510-28594-1-git-send-email-jgross@suse.com> References: <1477932510-28594-1-git-send-email-jgross@suse.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1243 Lines: 38 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 --- drivers/xen/xen-pciback/xenbus.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/xen/xen-pciback/xenbus.c b/drivers/xen/xen-pciback/xenbus.c index 5ce878c..3f0aee0 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: -- 2.6.6