Received: from eggs.gnu.org ([2001:4830:134:3::10]:56950) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XKBlJ-0003cV-Dp for qemu-devel@nongnu.org; Wed, 20 Aug 2014 15:41:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XKBlD-0002OH-8m for qemu-devel@nongnu.org; Wed, 20 Aug 2014 15:41:37 -0400 Received: from mx1.redhat.com ([209.132.183.28]:60214) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XKBlD-0002O9-0e for qemu-devel@nongnu.org; Wed, 20 Aug 2014 15:41:31 -0400 Message-ID: <1408563671.30803.3.camel@ul30vt.home> From: Alex Williamson Date: Wed, 20 Aug 2014 13:41:11 -0600 In-Reply-To: <53F4F336.1040101@amd.com> References: <1407594349-9291-1-git-send-email-eric.auger@linaro.org> <1407594349-9291-7-git-send-email-eric.auger@linaro.org> <53F4F336.1040101@amd.com> Content-Type: text/plain; charset="UTF-8" Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v5 06/10] hw/vfio: create common module List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Joel Schopp Cc: agraf@suse.de, kim.phillips@freescale.com, eric.auger@st.com, Eric Auger , peter.maydell@linaro.org, patches@linaro.org, will.deacon@arm.com, a.rigo@virtualopensystems.com, qemu-devel@nongnu.org, Bharat.Bhushan@freescale.com, Kim Phillips , stuart.yoder@freescale.com, a.motakis@virtualopensystems.com, kvmarm@lists.cs.columbia.edu, christoffer.dall@linaro.org On Wed, 2014-08-20 at 14:12 -0500, Joel Schopp wrote: > > +int vfio_get_device(VFIOGroup *group, const char *name, > > + VFIODevice *vbasedev) > > +{ > > + struct vfio_device_info dev_info = { .argsz = sizeof(dev_info) }; > > + struct vfio_region_info reg_info = { .argsz = sizeof(reg_info) }; > > + struct vfio_irq_info irq_info = { .argsz = sizeof(irq_info) }; > > + int ret; > > + > > + ret = ioctl(group->fd, VFIO_GROUP_GET_DEVICE_FD, name); > > + if (ret < 0) { > Should be: > if(ret) { > instead of: > if (ret < 0) { > > The ioctl can, and sometimes does, return positive values in case of > errors. This should also be fixed in vfio_container_do_ioctl() This particular ioctl usually does return a positive value, the file descriptor for the the device, so I think it's correct as written. Thanks, Alex