From nobody Wed Feb 11 01:28:38 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.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 216.205.24.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=1612314440; cv=none; d=zohomail.com; s=zohoarc; b=Amnu1iT8pJ4JQEKxVWIzuGzLDXhZ4oZwMofW+u/HXtH5TC7ydikw1jNtXkXjFFd9Bl3gTvBJYQCq4CovWyQfCSKGHyH+LwRK2oo/FBmybM4zW8tW5chQRemjMcF+lhfRpikb6P/aPCqrtnC4YgZVtFsAJ/tdMOn5ZumxEjfy3VI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1612314440; 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=4bHsPNCafNjuLv+ar9kaZn4JLjonVYNzT+FWsYCDk+o=; b=hTo4CpubrOvAqUc/bUAFMJuNT6HoSk0kIQXR+sIpl4Szkyjetc92Eo1F/fP5AZ+6hkVNr8nVvGD4JFIRjU7pwrt2rpYIaGGVlA4rlEN/lWIHHHa3TeDSmqWIfTL21J7JI7If4+CikQmd21rm/4WgpD+Ubk1cTy5XhFEeh1w2IN4= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.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 [216.205.24.124]) by mx.zohomail.com with SMTPS id 1612314440384643.1387606075468; Tue, 2 Feb 2021 17:07:20 -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-81-JTw55YpqNbKo6AzNfBmP5w-1; Tue, 02 Feb 2021 20:07:16 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 0BA3881628; Wed, 3 Feb 2021 01:07:11 +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 DB4D55F9C0; Wed, 3 Feb 2021 01:07:10 +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 9E7305003E; Wed, 3 Feb 2021 01:07:10 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 11316nOc010343 for ; Tue, 2 Feb 2021 20:06:49 -0500 Received: by smtp.corp.redhat.com (Postfix) id 2263FEE38A; Wed, 3 Feb 2021 01:06:49 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast05.extmail.prod.ext.rdu2.redhat.com [10.11.55.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1C942EE388 for ; Wed, 3 Feb 2021 01:06:46 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.81]) (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 9E00A800157 for ; Wed, 3 Feb 2021 01:06:46 +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-569-ByaihuO_NSi6fuUIluTT1Q-1; Tue, 02 Feb 2021 20:06:42 -0500 Received: by mail-qt1-f176.google.com with SMTP id t14so16448911qto.8; Tue, 02 Feb 2021 17:06:42 -0800 (PST) Received: from rekt.ibmuc.com ([2804:431:c7c6:6df1:6267:881f:cc79:a1f7]) by smtp.gmail.com with ESMTPSA id g6sm328813qtr.87.2021.02.02.17.06.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Feb 2021 17:06:41 -0800 (PST) X-MC-Unique: JTw55YpqNbKo6AzNfBmP5w-1 X-MC-Unique: ByaihuO_NSi6fuUIluTT1Q-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=4bHsPNCafNjuLv+ar9kaZn4JLjonVYNzT+FWsYCDk+o=; b=Xc/Or1q5OmZmdvmcJ4rXnNEiXExZOx4KziGSoYNMmw+1Ou4RjmeAowxqVT57/DitnP tBnw5mHlA9Jj0F/YE/vbKVrLDMUxWlXHUBgDLftsr7kOeERtoiMmO1RyV3UFu9uOx6KT 0wKv+N+VH3WVTzMK1gb/ML9oNe1DDo0DBSBTSQiF9Nx0lfHIV3KY0OKPodSw7eReMoOG yxacBGiu6aWaeezZntaGBx2Ka00gWgU7pR7fK49S7z3ZxIpnPhq8/9+adjaK9JRdUZ+8 lPfRzyUIU4D8nRggqWjOnoetp9mbJuGbjnJ6rmfiSV18HlxZstWSkuexxEStTAujrzKe OKCg== X-Gm-Message-State: AOAM531agR+ZBZ/L6jmv4w4XpkH6BbfpSsZQDwLad7D4Fo0gu6u98MM/ TXLuTqojsjR6jToIHktOPjUFjESQuLQ= X-Google-Smtp-Source: ABdhPJyRFElXDNViciUuN3QDWO+EhW7j9XT2lrOMObrxwYB741RZjbZGvNJDiB2j503ink/GRc3qZw== X-Received: by 2002:ac8:5854:: with SMTP id h20mr535235qth.301.1612314401586; Tue, 02 Feb 2021 17:06:41 -0800 (PST) From: Daniel Henrique Barboza To: libvir-list@redhat.com Subject: [PATCH v2 03/10] domain_driver.c: use g_auto* in virDomainDriverNodeDeviceReset() Date: Tue, 2 Feb 2021 22:06:18 -0300 Message-Id: <20210203010625.2328911-4-danielhb413@gmail.com> In-Reply-To: <20210203010625.2328911-1-danielhb413@gmail.com> References: <20210203010625.2328911-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.79 on 10.11.54.5 X-loop: libvir-list@redhat.com Cc: Daniel Henrique Barboza , =?UTF-8?q?J=C3=A1n=20Tomko?= 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.16 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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Reviewed-by: J=C3=A1n Tomko Signed-off-by: Daniel Henrique Barboza --- src/hypervisor/domain_driver.c | 33 ++++++++++++--------------------- 1 file changed, 12 insertions(+), 21 deletions(-) diff --git a/src/hypervisor/domain_driver.c b/src/hypervisor/domain_driver.c index 0c86fd714f..82e5587a50 100644 --- a/src/hypervisor/domain_driver.c +++ b/src/hypervisor/domain_driver.c @@ -375,51 +375,42 @@ int virDomainDriverNodeDeviceReset(virNodeDevicePtr dev, virHostdevManagerPtr hostdevMgr) { - virPCIDevicePtr pci; + g_autoptr(virPCIDevice) pci =3D NULL; virPCIDeviceAddress devAddr; - virNodeDeviceDefPtr def =3D NULL; + g_autoptr(virNodeDeviceDef) def =3D NULL; g_autofree char *xml =3D NULL; - virConnectPtr nodeconn =3D NULL; - virNodeDevicePtr nodedev =3D NULL; - int ret =3D -1; + g_autoptr(virConnect) nodeconn =3D NULL; + g_autoptr(virNodeDevice) nodedev =3D NULL; =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 (virNodeDeviceResetEnsureACL(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; - - ret =3D virHostdevPCINodeDeviceReset(hostdevMgr, pci); - - virPCIDeviceFree(pci); - cleanup: - virNodeDeviceDefFree(def); - virObjectUnref(nodedev); - virObjectUnref(nodeconn); - return ret; + return -1; =20 + return virHostdevPCINodeDeviceReset(hostdevMgr, pci); } --=20 2.26.2