From patchwork Thu Nov 17 06:47:15 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Dai X-Patchwork-Id: 17060 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [IPv6:::1]) by dpdk.org (Postfix) with ESMTP id 472015681; Thu, 17 Nov 2016 07:50:07 +0100 (CET) Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by dpdk.org (Postfix) with ESMTP id 08D185599 for ; Thu, 17 Nov 2016 07:50:04 +0100 (CET) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga105.jf.intel.com with ESMTP; 16 Nov 2016 22:50:03 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.31,504,1473145200"; d="scan'208";a="902373895" Received: from dpdk2.bj.intel.com ([172.16.182.65]) by orsmga003.jf.intel.com with ESMTP; 16 Nov 2016 22:50:02 -0800 From: Wei Dai To: david.marchand@6wind.com, olivier.matz@6wind.com Cc: dev@dpdk.org, Wei Dai Date: Thu, 17 Nov 2016 14:47:15 +0800 Message-Id: <1479365235-134903-1-git-send-email-wei.dai@intel.com> X-Mailer: git-send-email 2.5.5 In-Reply-To: <1479264047-67966-1-git-send-email-wei.dai@intel.com> References: <1479264047-67966-1-git-send-email-wei.dai@intel.com> Subject: [dpdk-dev] [PATCH v3] eal/linuxapp: fix return value check of mknod() X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" In function pci_mknod_uio_dev() in lib/librte_eal/eal/eal_pci_uio.c, The return value of mknod() is ret, not f got by fopen(). So the value of ret should be checked for mknod(). Fixes: f7f97c16048e ("pci: add option --create-uio-dev to run without hotplug") Signed-off-by: Wei Dai Acked-by: Olivier Matz --- v3: * correct Fixes: line in git commit message body v2: * fix my local git setting and send same patch again to remove "From: Wei Dai " in git commit message body and make merging easier lib/librte_eal/linuxapp/eal/eal_pci_uio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/librte_eal/linuxapp/eal/eal_pci_uio.c b/lib/librte_eal/linuxapp/eal/eal_pci_uio.c index 1786b75..3e4ffb5 100644 --- a/lib/librte_eal/linuxapp/eal/eal_pci_uio.c +++ b/lib/librte_eal/linuxapp/eal/eal_pci_uio.c @@ -133,7 +133,7 @@ pci_mknod_uio_dev(const char *sysfs_uio_path, unsigned uio_num) snprintf(filename, sizeof(filename), "/dev/uio%u", uio_num); dev = makedev(major, minor); ret = mknod(filename, S_IFCHR | S_IRUSR | S_IWUSR, dev); - if (f == NULL) { + if (ret != 0) { RTE_LOG(ERR, EAL, "%s(): mknod() failed %s\n", __func__, strerror(errno)); return -1;