From patchwork Thu Apr 10 08:24:32 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laszlo Ersek X-Patchwork-Id: 338044 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 132D91400BD for ; Thu, 10 Apr 2014 18:27:30 +1000 (EST) Received: from localhost ([::1]:49669 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WYAKW-0003D7-4a for incoming@patchwork.ozlabs.org; Thu, 10 Apr 2014 04:27:28 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47233) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WYAI7-0005N9-W7 for qemu-devel@nongnu.org; Thu, 10 Apr 2014 04:25:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WYAI1-0003KD-5b for qemu-devel@nongnu.org; Thu, 10 Apr 2014 04:24:59 -0400 Received: from mx1.redhat.com ([209.132.183.28]:45686) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WYAI0-0003K6-SE for qemu-devel@nongnu.org; Thu, 10 Apr 2014 04:24:53 -0400 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s3A8Opvw011667 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 10 Apr 2014 04:24:52 -0400 Received: from lacos-laptop-7.usersys.redhat.com (ovpn-116-60.ams2.redhat.com [10.36.116.60]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s3A8OlIT005705 for ; Thu, 10 Apr 2014 04:24:51 -0400 From: Laszlo Ersek To: qemu-devel@nongnu.org Date: Thu, 10 Apr 2014 10:24:32 +0200 Message-Id: <1397118285-11715-4-git-send-email-lersek@redhat.com> In-Reply-To: <1397118285-11715-1-git-send-email-lersek@redhat.com> References: <1397118285-11715-1-git-send-email-lersek@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.27 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 03/16] pci-assign: accept Error from monitor_handle_fd_param2() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Propagate any errors in monitor fd handling up to get_real_device(), and report them there. We'll continue the propagation upwards when get_real_device() becomes a leaf itself (when none of its callees will report errors internally any longer when detecting and returning an error). Signed-off-by: Laszlo Ersek Reviewed-by: Eric Blake --- hw/i386/kvm/pci-assign.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/hw/i386/kvm/pci-assign.c b/hw/i386/kvm/pci-assign.c index a825871..bfce97f 100644 --- a/hw/i386/kvm/pci-assign.c +++ b/hw/i386/kvm/pci-assign.c @@ -539,22 +539,27 @@ static int get_real_device(AssignedDevice *pci_dev) FILE *f; uint64_t start, end, size, flags; uint16_t id; PCIRegion *rp; PCIDevRegions *dev = &pci_dev->real_device; + Error *local_err = NULL; dev->region_number = 0; snprintf(dir, sizeof(dir), "/sys/bus/pci/devices/%04x:%02x:%02x.%x/", pci_dev->host.domain, pci_dev->host.bus, pci_dev->host.slot, pci_dev->host.function); snprintf(name, sizeof(name), "%sconfig", dir); if (pci_dev->configfd_name && *pci_dev->configfd_name) { - dev->config_fd = monitor_handle_fd_param(cur_mon, pci_dev->configfd_name); - if (dev->config_fd < 0) { + dev->config_fd = monitor_handle_fd_param2(cur_mon, + pci_dev->configfd_name, + &local_err); + if (local_err) { + qerror_report_err(local_err); + error_free(local_err); return 1; } } else { dev->config_fd = open(name, O_RDWR);