From nobody Sat Feb 7 09:59:21 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=1612180032; cv=none; d=zohomail.com; s=zohoarc; b=P2dZbSyT54mEyUE1KrsRH+Yb2YybNodZIuMpgvuMz/mVD+Jky1uoOBGidL5fXMU4h0oZc0Rz2YrWbOnX1QEGQ9ZFhr4sVXhRWNbO11PaHlJQy4fErEjtx7K55jcraf0bU5a3rYGs0ru9DYxREi+tz9SJbkp5xp3XzmC+oDrt4lw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1612180032; 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=wMmuGY/UpzWka7F4CXvYHp9Jd19zxpoBGsfaMXF3hYQ=; b=aRkqwazouNK4FJ9jM4rCDJHMHzUpC2G9W+9a8lMIoDKCNwlF19EX6cmLo62zAh9z7VH/O5iGTa95JP6/iw4F6BU6cZI4XFaDkOunkmv5t+nrKMrGjYKoHrunIMXb9cMYuNJGkYVY2B6s6jssxJ90NjmS2wozWXu63mT3JfB1OeU= 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 1612180032338348.1414540078964; Mon, 1 Feb 2021 03:47:12 -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-441-aXwm9NQ1NoqeWNv1QgCu0w-1; Mon, 01 Feb 2021 06:47:09 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 39AD85B361; Mon, 1 Feb 2021 11:47:03 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 154AA60D06; Mon, 1 Feb 2021 11:47:03 +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 C790D1809C9F; Mon, 1 Feb 2021 11:47:02 +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 111Bl0uR005719 for ; Mon, 1 Feb 2021 06:47:00 -0500 Received: by smtp.corp.redhat.com (Postfix) id 6CAE044076; Mon, 1 Feb 2021 11:47:00 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast06.extmail.prod.ext.rdu2.redhat.com [10.11.55.22]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 66BFD6379F for ; Mon, 1 Feb 2021 11:46:57 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.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 8A731187504F for ; Mon, 1 Feb 2021 11:46:57 +0000 (UTC) Received: from mail-qk1-f180.google.com (mail-qk1-f180.google.com [209.85.222.180]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-239-nVH1RuG3Pfmeyw7a13p4UA-1; Mon, 01 Feb 2021 06:46:55 -0500 Received: by mail-qk1-f180.google.com with SMTP id a12so15818493qkh.10 for ; Mon, 01 Feb 2021 03:46:55 -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.46.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 Feb 2021 03:46:54 -0800 (PST) X-MC-Unique: aXwm9NQ1NoqeWNv1QgCu0w-1 X-MC-Unique: nVH1RuG3Pfmeyw7a13p4UA-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=wMmuGY/UpzWka7F4CXvYHp9Jd19zxpoBGsfaMXF3hYQ=; b=kBK7GDyZsd2oM5RQ9K18s9/MAK7qyudmb+D6ygAcAYDWisK4SOYX3kLnlU6y5wMZfh L8iOH/TX3D3Hx6byKhXhFbx3zVroC0RcbXO0zNZe0XH2S/HoxsgrzrAZJvYBb5kw0R0U PlFWTXw9NYB/ZXxMAi21FOa8eBLa7Y5UENavvtiG2ezaavsnWP3EIV/fml3a3fRsvD/q emhY1DjXRZtot5Ew/PncgLZFiRRA4YIezg5XweE7I7P1+kX0s6VQ9y+PvXkZpUiVv8Fx 0KgN6i0y9QZt7uM2cwJ7Lm5RWgblBM7VQ87HcFv+95HtAY5d5eVF4tOiY1QW99h1shAr hmcg== X-Gm-Message-State: AOAM533hIb/TJraSk7qFfV+zdqEHbdH7IiH61J89Kec6H2EyQrfBdZcr 171XR5LGrl1dKHXrahTewTZQzg3UV7w= X-Google-Smtp-Source: ABdhPJxI9cSmZcpZkOrbT8FLekOzEmqHbD2ZADnfYcFmB1wNYEtHU5UcGq2Pki1ypg5SK0YQ/gW8Zg== X-Received: by 2002:a37:ad4:: with SMTP id 203mr15360970qkk.125.1612180014725; Mon, 01 Feb 2021 03:46:54 -0800 (PST) From: Daniel Henrique Barboza To: libvir-list@redhat.com Subject: [PATCH 3/9] domain_driver.c: use g_auto* in virDomainDriverNodeDeviceReset() Date: Mon, 1 Feb 2021 08:46:36 -0300 Message-Id: <20210201114642.1947595-4-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.79 on 10.11.54.5 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.13 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 | 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