From nobody Sat Feb 7 09:58:58 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1612180046; cv=none; d=zohomail.com; s=zohoarc; b=lWvHTeSIi2sItDvVDhdcizjnDxvJzQ3q3KI06uTqJ9d3a4IiPd9+8pANwbPvbcFmf3ASOXN2lg2U3WsAivgBRn+ZOdLEceuGHqPmm3mz54/fOqovOx64VOvDqJzPrqn5No9LaRIua2oY2zrV2v1LMEnCw5vIY6GYkN/aj9mAj1E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1612180046; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=RT5phc49dtO/flDiUw96YDi7iQYVcWmQLPwnTaOasBc=; b=l6kfoaZJJOXuJC0SxLmPSs2xdtksBWNynLn8tm4ux8qD+EOUme9aAYiMmNONadPY+YkD+c/kUcEJsadrq86tW9y6DUWdFP7GxONzJoZG53UzbqoEYYGR+cgvUq6r7qUqpqg1jthK0C6BMJAJSJy+V6KEKp7ly8+W2kz6vZpk1FA= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.zohomail.com with SMTPS id 1612180046838685.3725403686709; Mon, 1 Feb 2021 03:47:26 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-556-V2w7AHxgP2q8i3Tx1G2E7A-1; Mon, 01 Feb 2021 06:47:24 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 9BA04801ABD; Mon, 1 Feb 2021 11:47:18 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 739B260C67; Mon, 1 Feb 2021 11:47:18 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 3BFE750043; Mon, 1 Feb 2021 11:47:18 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 111Bl6xs005781 for ; Mon, 1 Feb 2021 06:47:06 -0500 Received: by smtp.corp.redhat.com (Postfix) id E1149111144E; Mon, 1 Feb 2021 11:47:05 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast04.extmail.prod.ext.rdu2.redhat.com [10.11.55.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id DD44B111144C for ; Mon, 1 Feb 2021 11:47:05 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id CB29A101A56B for ; Mon, 1 Feb 2021 11:47:05 +0000 (UTC) Received: from mail-qt1-f176.google.com (mail-qt1-f176.google.com [209.85.160.176]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-584-9AmdmWp0NsaqsMcqTd_zPQ-1; Mon, 01 Feb 2021 06:47:03 -0500 Received: by mail-qt1-f176.google.com with SMTP id r20so8377576qtm.3 for ; Mon, 01 Feb 2021 03:47:03 -0800 (PST) Received: from rekt.ibmuc.com ([2804:431:c7c6:6df1:6267:881f:cc79:a1f7]) by smtp.gmail.com with ESMTPSA id t6sm13671374qti.2.2021.02.01.03.47.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 Feb 2021 03:47:02 -0800 (PST) X-MC-Unique: V2w7AHxgP2q8i3Tx1G2E7A-1 X-MC-Unique: 9AmdmWp0NsaqsMcqTd_zPQ-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=RT5phc49dtO/flDiUw96YDi7iQYVcWmQLPwnTaOasBc=; b=gnrTuPFaqn0GILU32LvhkV8yzDvxwQqQg8OIV2FRIB6nHPq+PxazSfTkgT/cxUFpyu 9HWfefpWvJmsEwgytvwZmgeIbH5OAAsSoMT17IQskEWz/+Keg9rR1q34mUBSYHxbUVvy wuEdXntfvj2rKt2rvXAAFP7zNleNnx9k/S1a2esZuch6Ure0RuSkx7S3RJw4CLsqwW0M 7vQHhYiYTQsqaw9GZW/GLvZh5JOHYualwXDOm5sxoiOM/52tWPMykiwOLcZhCWNMx5zO v/ToJ2HKIrdFB9sKMDTan8NuTO2aVyh4/1Ki/T/nicD1SzokntmVWKh6abh2mnt1IjJD xChw== X-Gm-Message-State: AOAM533aYW05YXO4xPHKBsnysSymhrfh+Fq1EuNCTuZRFvOAVYQg5YWv u8Bzplj35cumf5hxiBZOd+CyWUGZQa0= X-Google-Smtp-Source: ABdhPJyevvK2D9bBrRV/26OKuD6V2wW9s+XCHzBAxkHCBdaeDO8bvR6YXpcnSz8F/8IyMSKFR8a6vA== X-Received: by 2002:ac8:110e:: with SMTP id c14mr14086610qtj.293.1612180023200; Mon, 01 Feb 2021 03:47:03 -0800 (PST) From: Daniel Henrique Barboza To: libvir-list@redhat.com Subject: [PATCH 9/9] domain_driver.c: use g_auto* in virDomainDriverNodeDeviceDetachFlags() Date: Mon, 1 Feb 2021 08:46:42 -0300 Message-Id: <20210201114642.1947595-10-danielhb413@gmail.com> In-Reply-To: <20210201114642.1947595-1-danielhb413@gmail.com> References: <20210201114642.1947595-1-danielhb413@gmail.com> MIME-Version: 1.0 X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-loop: libvir-list@redhat.com Cc: Daniel Henrique Barboza X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Signed-off-by: Daniel Henrique Barboza --- src/hypervisor/domain_driver.c | 31 ++++++++++++------------------- 1 file changed, 12 insertions(+), 19 deletions(-) diff --git a/src/hypervisor/domain_driver.c b/src/hypervisor/domain_driver.c index 6ee74d6dff..c08b7d46c5 100644 --- a/src/hypervisor/domain_driver.c +++ b/src/hypervisor/domain_driver.c @@ -465,57 +465,50 @@ virDomainDriverNodeDeviceDetachFlags(virNodeDevicePtr= dev, virHostdevManagerPtr hostdevMgr, const char *driverName) { - virPCIDevicePtr pci =3D NULL; + g_autoptr(virPCIDevice) pci =3D NULL; virPCIDeviceAddress devAddr; - int ret =3D -1; - virNodeDeviceDefPtr def =3D NULL; + g_autoptr(virNodeDeviceDef) def =3D NULL; g_autofree char *xml =3D NULL; - virConnectPtr nodeconn =3D NULL; - virNodeDevicePtr nodedev =3D NULL; + g_autoptr(virConnect) nodeconn =3D NULL; + g_autoptr(virNodeDevice) nodedev =3D NULL; =20 if (!driverName) return -1; =20 if (!(nodeconn =3D virGetConnectNodeDev())) - goto cleanup; + return -1; =20 /* 'dev' is associated with virConnectPtr, so for split * daemons, we need to get a copy that is associated with * the virnodedevd daemon. */ if (!(nodedev =3D virNodeDeviceLookupByName(nodeconn, virNodeDeviceGetName(dev)))) - goto cleanup; + return -1; =20 xml =3D virNodeDeviceGetXMLDesc(nodedev, 0); if (!xml) - goto cleanup; + return -1; =20 def =3D virNodeDeviceDefParseString(xml, EXISTING_DEVICE, NULL); if (!def) - goto cleanup; + return -1; =20 /* ACL check must happen against original 'dev', * not the new 'nodedev' we acquired */ if (virNodeDeviceDetachFlagsEnsureACL(dev->conn, def) < 0) - goto cleanup; + return -1; =20 if (virDomainDriverNodeDeviceGetPCIInfo(def, &devAddr) < 0) - goto cleanup; + return -1; =20 pci =3D virPCIDeviceNew(&devAddr); if (!pci) - goto cleanup; + return -1; =20 if (STREQ(driverName, "vfio")) virPCIDeviceSetStubDriver(pci, VIR_PCI_STUB_DRIVER_VFIO); else if (STREQ(driverName, "xen")) virPCIDeviceSetStubDriver(pci, VIR_PCI_STUB_DRIVER_XEN); =20 - ret =3D virHostdevPCINodeDeviceDetach(hostdevMgr, pci); - cleanup: - virPCIDeviceFree(pci); - virNodeDeviceDefFree(def); - virObjectUnref(nodedev); - virObjectUnref(nodeconn); - return ret; + return virHostdevPCINodeDeviceDetach(hostdevMgr, pci); } --=20 2.26.2