From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33298) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XKCEI-00068G-8W for qemu-devel@nongnu.org; Wed, 20 Aug 2014 16:11:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XKCEA-0003Ag-L8 for qemu-devel@nongnu.org; Wed, 20 Aug 2014 16:11:34 -0400 Received: from mail-bl2lp0206.outbound.protection.outlook.com ([207.46.163.206]:8465 helo=na01-bl2-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XKCEA-0003AO-Et for qemu-devel@nongnu.org; Wed, 20 Aug 2014 16:11:26 -0400 Message-ID: <53F50049.4060903@amd.com> Date: Wed, 20 Aug 2014 15:08:41 -0500 From: Joel Schopp MIME-Version: 1.0 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> <1408563671.30803.3.camel@ul30vt.home> In-Reply-To: <1408563671.30803.3.camel@ul30vt.home> Content-Type: text/plain; charset="UTF-8" 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: Alex Williamson 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 08/20/2014 02:41 PM, Alex Williamson wrote: > 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, Thanks for the catch, I stand corrected. The kernel I am running against contains corresponding patches that are spitting out an erroneous pr_err() on if(ret). In retrospect it looks like the kernel patches and not the qemu patches are in the wrong.