From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id D2369475E for ; Wed, 16 Nov 2016 16:17:14 +0100 (CET) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga101.fm.intel.com with ESMTP; 16 Nov 2016 07:17:13 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.31,500,1473145200"; d="scan'208";a="5071787" Received: from pgsmsx107.gar.corp.intel.com ([10.221.44.105]) by orsmga002.jf.intel.com with ESMTP; 16 Nov 2016 07:17:12 -0800 Received: from pgsmsx106.gar.corp.intel.com ([169.254.9.114]) by PGSMSX107.gar.corp.intel.com ([169.254.7.110]) with mapi id 14.03.0248.002; Wed, 16 Nov 2016 23:17:10 +0800 From: "Dai, Wei" To: "Yigit, Ferruh" , "Lu, Wenzhuo" , "dev@dpdk.org" , "Burakov, Anatoly" , "david.marchand@6wind.com" Thread-Topic: [dpdk-dev] [PATCH v2] eal/linuxapp: fix return value check of mknod() Thread-Index: AQHSP/k/kwNqWO5biUWVum+gAmfu8aDbteIQ Date: Wed, 16 Nov 2016 15:17:09 +0000 Message-ID: <49759EB36A64CF4892C1AFEC9231E8D63A2EE798@PGSMSX106.gar.corp.intel.com> References: <1479262339-63608-1-git-send-email-zhiyong.yang@intel.com> <1479264047-67966-1-git-send-email-wei.dai@intel.com> <6A0DE07E22DDAD4C9103DF62FEBC09093935007B@shsmsx102.ccr.corp.intel.com> <213865d3-d1fa-3caa-92de-3970637b653d@intel.com> In-Reply-To: <213865d3-d1fa-3caa-92de-3970637b653d@intel.com> Accept-Language: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiZTU0YjljMTctZWNlMy00MWMzLWIyN2QtMmYzNDI0NzJlYTFkIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE1LjkuNi42IiwiVHJ1c3RlZExhYmVsSGFzaCI6IlFRV3dQa0djTDFzengwQWJxak5SOGE0Q3hKUXBoM1wvSk0zVGo1bGlcL2UwST0ifQ== x-ctpclassification: CTP_IC x-originating-ip: [172.30.20.205] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH v2] 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: , X-List-Received-Date: Wed, 16 Nov 2016 15:17:15 -0000 Thanks to Yigit Ferruh and Wenzhuo for your guide. Several months ago, I download checkpatch.pl and put it in /root/bin/. In /root/.bash_profile in my server, there is line :export DPDK_CHECKPATCH= _PATH=3D/root/bin/checkpatch.pl Before I send this patch, I have run checkpath.sh to check it and it show n= o error. ./scripts/checkpatch.sh -v v2-0001-eal-*.patch By search ' !=3D 0', there are many lines in many modules of DPDK. So I think ' !=3D0' is OK. > -----Original Message----- > From: Yigit, Ferruh > Sent: Wednesday, November 16, 2016 7:04 PM > To: Lu, Wenzhuo ; Dai, Wei ; > dev@dpdk.org; Burakov, Anatoly ; > david.marchand@6wind.com > Subject: Re: [dpdk-dev] [PATCH v2] eal/linuxapp: fix return value check o= f > mknod() >=20 > Hi Wenzhuo, >=20 > On 11/16/2016 3:28 AM, Lu, Wenzhuo wrote: > > Hi Wei, > > > >> -----Original Message----- > >> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Wei Dai > >> Sent: Wednesday, November 16, 2016 10:41 AM > >> To: dev@dpdk.org; Burakov, Anatoly; david.marchand@6wind.com; Dai, > >> Wei > >> Subject: [dpdk-dev] [PATCH v2] eal/linuxapp: fix return value check > >> of mknod() > >> > >> 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: 67c536bdad93 ("pci: move uio mapping in a dedicated file") > >> > >> Signed-off-by: Wei Dai > >> --- > >> fix my local git setting and send same patch again to 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 =3D makedev(major, minor); > >> ret =3D mknod(filename, S_IFCHR | S_IRUSR | S_IWUSR, dev); > >> - if (f =3D=3D NULL) { > >> + if (ret !=3D 0) { > > I think checkpatch will suggest to just use if (ret) >=20 > Your are right, default checkpatch.pl complains about this usage (with --= strict > option), but: >=20 > - According DPDK coding style this usage is preferred (although I persona= lly > prefer kernel one..) >=20 > http://dpdk.org/doc/guides/contributing/coding_style.html#null-pointers >=20 > " > if (p =3D=3D NULL) /* Good, compare pointer to NULL */ >=20 > if (!p) /* Bad, using ! on pointer */ > " >=20 > - This warning disabled in dpdk scripts/checkpatches.sh by "--ignore > COMPARISON_TO_NULL", so it shouldn't complain. >=20 >=20