From patchwork Mon Oct 17 19:54:03 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Williamson X-Patchwork-Id: 683363 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3syTlQ4VWJz9rvt for ; Tue, 18 Oct 2016 07:07:46 +1100 (AEDT) Received: from localhost ([::1]:35639 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bwECF-0001uT-Br for incoming@patchwork.ozlabs.org; Mon, 17 Oct 2016 16:07:43 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34060) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bwDz3-0005mU-Qr for qemu-devel@nongnu.org; Mon, 17 Oct 2016 15:54:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bwDz2-0000l9-Vy for qemu-devel@nongnu.org; Mon, 17 Oct 2016 15:54:05 -0400 Received: from mx1.redhat.com ([209.132.183.28]:55018) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1bwDz2-0000ko-Nu for qemu-devel@nongnu.org; Mon, 17 Oct 2016 15:54:04 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id EE6BDC04B328 for ; Mon, 17 Oct 2016 19:54:03 +0000 (UTC) Received: from gimli.home (ovpn-116-107.phx2.redhat.com [10.3.116.107]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u9HJs3hF002991; Mon, 17 Oct 2016 15:54:03 -0400 From: Alex Williamson To: qemu-devel@nongnu.org Date: Mon, 17 Oct 2016 13:54:03 -0600 Message-ID: <20161017195400.17307.70646.stgit@gimli.home> In-Reply-To: <20161017194945.17307.78340.stgit@gimli.home> References: <20161017194945.17307.78340.stgit@gimli.home> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Mon, 17 Oct 2016 19:54:03 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 16/19] vfio/pci: Remove vfio_populate_device returned value X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Eric Auger , Markus Armbruster Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Eric Auger The returned value (either -errno or -1) is not used anymore by the caller, vfio_realize, since the error now is stored in the error object. So let's remove it. Signed-off-by: Eric Auger Reviewed-by: Markus Armbruster Signed-off-by: Alex Williamson --- hw/vfio/pci.c | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c index f063c65..6d01324 100644 --- a/hw/vfio/pci.c +++ b/hw/vfio/pci.c @@ -2223,7 +2223,7 @@ int vfio_populate_vga(VFIOPCIDevice *vdev, Error **errp) return 0; } -static int vfio_populate_device(VFIOPCIDevice *vdev, Error **errp) +static void vfio_populate_device(VFIOPCIDevice *vdev, Error **errp) { VFIODevice *vbasedev = &vdev->vbasedev; struct vfio_region_info *reg_info; @@ -2233,18 +2233,18 @@ static int vfio_populate_device(VFIOPCIDevice *vdev, Error **errp) /* Sanity check device */ if (!(vbasedev->flags & VFIO_DEVICE_FLAGS_PCI)) { error_setg(errp, "this isn't a PCI device"); - goto error; + return; } if (vbasedev->num_regions < VFIO_PCI_CONFIG_REGION_INDEX + 1) { error_setg(errp, "unexpected number of io regions %u", vbasedev->num_regions); - goto error; + return; } if (vbasedev->num_irqs < VFIO_PCI_MSIX_IRQ_INDEX + 1) { error_setg(errp, "unexpected number of irqs %u", vbasedev->num_irqs); - goto error; + return; } for (i = VFIO_PCI_BAR0_REGION_INDEX; i < VFIO_PCI_ROM_REGION_INDEX; i++) { @@ -2256,7 +2256,7 @@ static int vfio_populate_device(VFIOPCIDevice *vdev, Error **errp) if (ret) { error_setg_errno(errp, -ret, "failed to get region %d info", i); - goto error; + return; } QLIST_INIT(&vdev->bars[i].quirks); @@ -2266,7 +2266,7 @@ static int vfio_populate_device(VFIOPCIDevice *vdev, Error **errp) VFIO_PCI_CONFIG_REGION_INDEX, ®_info); if (ret) { error_setg_errno(errp, -ret, "failed to get config info"); - goto error; + return; } trace_vfio_populate_device_config(vdev->vbasedev.name, @@ -2287,7 +2287,7 @@ static int vfio_populate_device(VFIOPCIDevice *vdev, Error **errp) if (ret) { error_append_hint(errp, "device does not support " "requested feature x-vga\n"); - goto error; + return; } } @@ -2297,7 +2297,6 @@ static int vfio_populate_device(VFIOPCIDevice *vdev, Error **errp) if (ret) { /* This can fail for an old kernel or legacy PCI dev */ trace_vfio_populate_device_get_irq_info_failure(); - ret = 0; } else if (irq_info.count == 1) { vdev->pci_aer = true; } else { @@ -2305,9 +2304,6 @@ static int vfio_populate_device(VFIOPCIDevice *vdev, Error **errp) "Could not enable error recovery for the device", vbasedev->name); } - -error: - return ret; } static void vfio_put_device(VFIOPCIDevice *vdev) @@ -2579,8 +2575,9 @@ static void vfio_realize(PCIDevice *pdev, Error **errp) goto error; } - ret = vfio_populate_device(vdev, errp); - if (ret) { + vfio_populate_device(vdev, &err); + if (err) { + error_propagate(errp, err); goto error; }