From nobody Mon Feb 9 05:01:27 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 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=1565610884; cv=none; d=zoho.com; s=zohoarc; b=ZXCDAipl9THe+Okz8LMQZheUN7LNbm9wgM/v39jjlrbHqG7593t8YvzTKwL3JYhY9TxqkSu62PeRf9Q6rT0x4f3i9gfEmIS/jpHE0OfTjPfUMjMDARl5nr6WnwCO7zxLWgAedYrOlHgOtkv0KYIYHc5POTYizJKb2xvsGDG7Sr8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1565610884; 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:ARC-Authentication-Results; bh=Kemnm1OmH8PaYAsix9OPL1/Bg+p87GolytoO/0Te3Wg=; b=CJSjOTSOP/N9EbG661LY32z9/8HJx9yZ0oo/ff6SSz5wBDJ0fYW/uZJd5H2bNrCN8xdmH5128BRlCHHZ7bcH1VnDCx8S/Ooiwr3F++zzzmB/iJymYaBMrepA8duhmW8FP+ECnN8oCaYhKlHRIIE/MpJuGn5Z+AhVHaGuIxSMu9Y= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1565610884426484.8874997704272; Mon, 12 Aug 2019 04:54:44 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 223143CA0B; Mon, 12 Aug 2019 11:54:43 +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 012AB5D9CA; Mon, 12 Aug 2019 11:54:43 +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 B73C6180124D; Mon, 12 Aug 2019 11:54:42 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x7CBsYUg016166 for ; Mon, 12 Aug 2019 07:54:34 -0400 Received: by smtp.corp.redhat.com (Postfix) id C98621001B17; Mon, 12 Aug 2019 11:54:34 +0000 (UTC) Received: from moe.brq.redhat.com (unknown [10.43.2.30]) by smtp.corp.redhat.com (Postfix) with ESMTP id 55B501001B1A for ; Mon, 12 Aug 2019 11:54:32 +0000 (UTC) From: Michal Privoznik To: libvir-list@redhat.com Date: Mon, 12 Aug 2019 13:54:20 +0200 Message-Id: <885689ab9378485b5d7b1efe677656b0a32cb309.1565610801.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 4/9] virhostdevtest: Check for integer retval in more verbose way 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: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Mon, 12 Aug 2019 11:54:43 +0000 (UTC) Content-Type: text/plain; charset="utf-8" From: Michal Privoznik There are few functions called from the test which return an integer but their retval is compared as if it was a pointer. Now, there is nothing wrong with that from machine POV, but from readability perspective it's wrong. Signed-off-by: Michal Privoznik Reviewed-by: J=C3=A1n Tomko --- tests/virhostdevtest.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/tests/virhostdevtest.c b/tests/virhostdevtest.c index 20984f3442..2c65db2068 100644 --- a/tests/virhostdevtest.c +++ b/tests/virhostdevtest.c @@ -161,22 +161,22 @@ testVirHostdevPreparePCIHostdevs_unmanaged(void) active_count =3D virPCIDeviceListCount(mgr->activePCIHostdevs); inactive_count =3D virPCIDeviceListCount(mgr->inactivePCIHostdevs); VIR_DEBUG("Test: prepare same hostdevs for same driver/domain again"); - if (!virHostdevPreparePCIDevices(mgr, drv_name, dom_name, uuid, - &hostdevs[0], 1, 0)) + if (virHostdevPreparePCIDevices(mgr, drv_name, dom_name, uuid, + &hostdevs[0], 1, 0) =3D=3D 0) goto cleanup; CHECK_PCI_LIST_COUNT(mgr->activePCIHostdevs, active_count); CHECK_PCI_LIST_COUNT(mgr->inactivePCIHostdevs, inactive_count); =20 VIR_DEBUG("Test: prepare same hostdevs for same driver, diff domain ag= ain"); - if (!virHostdevPreparePCIDevices(mgr, drv_name, "test_domain1", uuid, - &hostdevs[1], 1, 0)) + if (virHostdevPreparePCIDevices(mgr, drv_name, "test_domain1", uuid, + &hostdevs[1], 1, 0) =3D=3D 0) goto cleanup; CHECK_PCI_LIST_COUNT(mgr->activePCIHostdevs, active_count); CHECK_PCI_LIST_COUNT(mgr->inactivePCIHostdevs, inactive_count); =20 VIR_DEBUG("Test: prepare same hostdevs for diff driver/domain again"); - if (!virHostdevPreparePCIDevices(mgr, "test_driver1", dom_name, uuid, - &hostdevs[2], 1, 0)) + if (virHostdevPreparePCIDevices(mgr, "test_driver1", dom_name, uuid, + &hostdevs[2], 1, 0) =3D=3D 0) goto cleanup; CHECK_PCI_LIST_COUNT(mgr->activePCIHostdevs, active_count); CHECK_PCI_LIST_COUNT(mgr->inactivePCIHostdevs, inactive_count); @@ -252,22 +252,22 @@ testVirHostdevPreparePCIHostdevs_managed(bool mixed) active_count =3D virPCIDeviceListCount(mgr->activePCIHostdevs); inactive_count =3D virPCIDeviceListCount(mgr->inactivePCIHostdevs); VIR_DEBUG("Test: prepare same hostdevs for same driver/domain again"); - if (!virHostdevPreparePCIDevices(mgr, drv_name, dom_name, uuid, - &hostdevs[0], 1, 0)) + if (virHostdevPreparePCIDevices(mgr, drv_name, dom_name, uuid, + &hostdevs[0], 1, 0) =3D=3D 0) goto cleanup; CHECK_PCI_LIST_COUNT(mgr->activePCIHostdevs, active_count); CHECK_PCI_LIST_COUNT(mgr->inactivePCIHostdevs, inactive_count); =20 VIR_DEBUG("Test: prepare same hostdevs for same driver, diff domain ag= ain"); - if (!virHostdevPreparePCIDevices(mgr, drv_name, "test_domain1", uuid, - &hostdevs[1], 1, 0)) + if (virHostdevPreparePCIDevices(mgr, drv_name, "test_domain1", uuid, + &hostdevs[1], 1, 0) =3D=3D 0) goto cleanup; CHECK_PCI_LIST_COUNT(mgr->activePCIHostdevs, active_count); CHECK_PCI_LIST_COUNT(mgr->inactivePCIHostdevs, inactive_count); =20 VIR_DEBUG("Test: prepare same hostdevs for diff driver/domain again"); - if (!virHostdevPreparePCIDevices(mgr, "test_driver1", dom_name, uuid, - &hostdevs[2], 1, 0)) + if (virHostdevPreparePCIDevices(mgr, "test_driver1", dom_name, uuid, + &hostdevs[2], 1, 0) =3D=3D 0) goto cleanup; CHECK_PCI_LIST_COUNT(mgr->activePCIHostdevs, active_count); CHECK_PCI_LIST_COUNT(mgr->inactivePCIHostdevs, inactive_count); --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list