From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stephen Hemminger Subject: [PATCH v2 1/3] pci: remove unnecessary casts from strtoul Date: Thu, 22 Jun 2017 08:56:39 -0700 Message-ID: <20170622155641.25916-2-stephen@networkplumber.org> References: <20170622155641.25916-1-stephen@networkplumber.org> Cc: Stephen Hemminger , Stephen Hemminger To: dev@dpdk.org Return-path: Received: from mail-pg0-f54.google.com (mail-pg0-f54.google.com [74.125.83.54]) by dpdk.org (Postfix) with ESMTP id 675525A98 for ; Thu, 22 Jun 2017 17:56:51 +0200 (CEST) Received: by mail-pg0-f54.google.com with SMTP id 132so9519864pgb.2 for ; Thu, 22 Jun 2017 08:56:51 -0700 (PDT) In-Reply-To: <20170622155641.25916-1-stephen@networkplumber.org> List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" The function strtoul returns unsigned long and can be directly assigned to a smaller type. Removing the casts allows easier expansion of PCI domain. Signed-off-by: Stephen Hemminger --- lib/librte_eal/linuxapp/eal/eal_pci.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/librte_eal/linuxapp/eal/eal_pci.c b/lib/librte_eal/linuxapp/eal/eal_pci.c index 595622b2129f..cfd3a8e92839 100644 --- a/lib/librte_eal/linuxapp/eal/eal_pci.c +++ b/lib/librte_eal/linuxapp/eal/eal_pci.c @@ -430,10 +430,10 @@ parse_pci_addr_format(const char *buf, int bufsize, struct rte_pci_addr *addr) /* now convert to int values */ errno = 0; - addr->domain = (uint16_t)strtoul(splitaddr.domain, NULL, 16); - addr->bus = (uint8_t)strtoul(splitaddr.bus, NULL, 16); - addr->devid = (uint8_t)strtoul(splitaddr.devid, NULL, 16); - addr->function = (uint8_t)strtoul(splitaddr.function, NULL, 10); + addr->domain = strtoul(splitaddr.domain, NULL, 16); + addr->bus = strtoul(splitaddr.bus, NULL, 16); + addr->devid = strtoul(splitaddr.devid, NULL, 16); + addr->function = strtoul(splitaddr.function, NULL, 10); if (errno != 0) goto error; -- 2.11.0