From nobody Mon Feb 9 00:07:35 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1628173026; cv=none; d=zohomail.com; s=zohoarc; b=AIuQTAYS3VapLIFM8FyF79Qg5kcia2fD87hlWQXZc/DrqgWG9MGc/Kdo4nLeICHGdiZvZsK07lSvUhLu9ITgW+oEt82k2Snzzl1Nj66Pz5dPknqH8LIaoTaKD11KqATeGoy2/XbIH3ZEdcTlX6p7ZITv+Rz3H6DjeqmEOSvnkt4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1628173026; h=Content-Type:Content-Transfer-Encoding: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=1U9VHvTdbauOe0gVG9Ea39b3wDM7cnWT6/WM8Q4V+3E=; b=ScmLf0Nz+3zI1DZ4A2G0VZFJoxRolJVIHNRcYQ57h/3ndX02+EB9bqBElOYYbx5dfSvyqCjOsc74MiXfxjusahLUuGMXzV6wCJAHHDeHFYCAqGuG/I/B0u7vWtFi03qh+dQ0VxJWfSJ5DyLQSs96g+soYR/XNZPJ4HmocWq+aPU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 162817302631987.61649926201937; Thu, 5 Aug 2021 07:17:06 -0700 (PDT) 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-590-4vAyrOt-MpKi_a2vUnzxkw-1; Thu, 05 Aug 2021 10:16:59 -0400 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 C1225871255; Thu, 5 Aug 2021 14:16:16 +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 A187B60BF4; Thu, 5 Aug 2021 14:16:16 +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 69598180BAC5; Thu, 5 Aug 2021 14:16:16 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 175EDJPe016822 for ; Thu, 5 Aug 2021 10:13:19 -0400 Received: by smtp.corp.redhat.com (Postfix) id 9422C5C1A1; Thu, 5 Aug 2021 14:13:19 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.40.208.33]) by smtp.corp.redhat.com (Postfix) with ESMTP id E7A0D6788C for ; Thu, 5 Aug 2021 14:13:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1628173025; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=1U9VHvTdbauOe0gVG9Ea39b3wDM7cnWT6/WM8Q4V+3E=; b=BQwbkVY+T1TIytB7XcQG5F0mDOQ+9hzNPH973DR0iF50GLO8Ek9WtP/Hw3KuK5o9Fyogp9 wLGjfvusmEJ1G//M6kye6BXwCBzJ66n3hfU5hgYdAMDB4e9coizm5ZY85AI+p7KwpssMDB G6IjS+yiXZwkQPxEBMrWvx8o4+VwNys= X-MC-Unique: 4vAyrOt-MpKi_a2vUnzxkw-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 3/6] virPCIGetVirtualFunctionIndex: Refactor cleanup Date: Thu, 5 Aug 2021 16:13:07 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com 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 X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1628173026690100003 Content-Type: text/plain; charset="utf-8" The 'ret' variable and 'out' label can be removed. Signed-off-by: Peter Krempa --- src/util/virpci.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/util/virpci.c b/src/util/virpci.c index 2afbf40af3..7059b29ec3 100644 --- a/src/util/virpci.c +++ b/src/util/virpci.c @@ -2409,31 +2409,28 @@ virPCIGetVirtualFunctionIndex(const char *pf_sysfs_= device_link, const char *vf_sysfs_device_link, int *vf_index) { - int ret =3D -1; size_t i; g_autofree virPCIDeviceAddress *vf_bdf =3D NULL; g_autoptr(virPCIVirtualFunctionList) virt_fns =3D NULL; if (!(vf_bdf =3D virPCIGetDeviceAddressFromSysfsLink(vf_sysfs_device_l= ink))) - return ret; + return -1; if (virPCIGetVirtualFunctions(pf_sysfs_device_link, &virt_fns) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, _("Error getting physical function's '%s' " "virtual_functions"), pf_sysfs_device_link); - goto out; + return -1; } for (i =3D 0; i < virt_fns->nfunctions; i++) { if (virPCIDeviceAddressEqual(vf_bdf, virt_fns->functions[i].addr))= { *vf_index =3D i; - ret =3D 0; - break; + return 0; } } - out: - return ret; + return -1; } /* --=20 2.31.1