From nobody Mon Feb 9 10:51:47 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.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.129.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=1641287151; cv=none; d=zohomail.com; s=zohoarc; b=GDdZW9EnSNRMR9l9i9DQHkckC/29NIw0GpzVVxbUdaiUp/GLR1ovHShk281sSwuO7OEunUuuQSzscCylTK59KCEarPVVvjAoZMSNSpeaI7YtdiHSPzm4DhqGPniVbMHsHiyZGuSjBH9Mo0VHVmt+tTnTsL1Hs2MWUoqnAnBnM5Q= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1641287151; 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=Nrp9ZCMUXFacQQWyskjjXAa9uD9z8djf0LVcZHx0heM=; b=lRNK12anNo1435/ie/8MdVKUuSkqc+xwMuMJRiyMMCBBOeaU2VrwmA2Nrw0PXkyZ+kreQ07T38CaeTU3AQoPp6aNhJ0bs2WT8HHJxChKaj68igq3uC+5OLanQJa6FVz+gr2m3U74/7Jlz1EGDZrNf7bC0D5z71cO1Pc8pZlXcjQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.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.129.124]) by mx.zohomail.com with SMTPS id 1641287151294660.6412676926498; Tue, 4 Jan 2022 01:05:51 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-447-LjvJqVSEM06-pxQuPkkGsg-1; Tue, 04 Jan 2022 04:05:47 -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 9B01B8042E0; Tue, 4 Jan 2022 09:05:42 +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 78D73171FF; Tue, 4 Jan 2022 09:05:42 +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 42ECE1806D1C; Tue, 4 Jan 2022 09:05:41 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 20495Tbx031383 for ; Tue, 4 Jan 2022 04:05:29 -0500 Received: by smtp.corp.redhat.com (Postfix) id A04AA7CD62; Tue, 4 Jan 2022 09:05:29 +0000 (UTC) Received: from maggie.redhat.com (unknown [10.43.2.64]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2AE337CAF6 for ; Tue, 4 Jan 2022 09:05:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1641287149; 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=Nrp9ZCMUXFacQQWyskjjXAa9uD9z8djf0LVcZHx0heM=; b=JO+CNKxSSmNvaiiDaik/vzXSNzNIL8MgGfQvA1IXlcVFqvFxF1/aBZneMV5Qg7rwTV0mqq YpoR3Z5Sm29hKeX5BLdzoGJEvhDcWYBP6tI2NUHBb7WLi6OW67hLuhd4Q2TlI+EygCzj8o 15i0zjJ4UtGAdGgSmV6eOhpSEfZpGX0= X-MC-Unique: LjvJqVSEM06-pxQuPkkGsg-1 From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH v2 3/3] conf: Make virDomainTPMDefFormat() return void Date: Tue, 4 Jan 2022 10:05:00 +0100 Message-Id: <89421c3d636eb388b7127b9151948f889036ef91.1641287042.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 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.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-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1641287153327100001 Content-Type: text/plain; charset="utf-8" The virDomainTPMDefFormat() function can't fail really. There's no point in it returning an integer then. Make it return void and fix both places which check for its retval. And while at it, turn @def into a const pointer to make it obvious the function does not modify passed struct. Signed-off-by: Michal Privoznik Reviewed-by: Peter Krempa --- src/conf/domain_conf.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 9e854d031e..fe53a280d7 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -25490,9 +25490,9 @@ virDomainSoundCodecDefFormat(virBuffer *buf, return 0; } =20 -static int +static void virDomainTPMDefFormat(virBuffer *buf, - virDomainTPMDef *def, + const virDomainTPMDef *def, unsigned int flags) { g_auto(virBuffer) attrBuf =3D VIR_BUFFER_INITIALIZER; @@ -25543,8 +25543,6 @@ virDomainTPMDefFormat(virBuffer *buf, virDomainDeviceInfoFormat(&childBuf, &def->info, flags); =20 virXMLFormatElement(buf, "tpm", &attrBuf, &childBuf); - - return 0; } =20 =20 @@ -28531,8 +28529,7 @@ virDomainDefFormatInternalSetRootName(virDomainDef = *def, } =20 for (n =3D 0; n < def->ntpms; n++) { - if (virDomainTPMDefFormat(buf, def->tpms[n], flags) < 0) - return -1; + virDomainTPMDefFormat(buf, def->tpms[n], flags); } =20 for (n =3D 0; n < def->ngraphics; n++) { @@ -29762,7 +29759,8 @@ virDomainDeviceDefCopy(virDomainDeviceDef *src, rc =3D virDomainChrDefFormat(&buf, src->data.chr, flags); break; case VIR_DOMAIN_DEVICE_TPM: - rc =3D virDomainTPMDefFormat(&buf, src->data.tpm, flags); + virDomainTPMDefFormat(&buf, src->data.tpm, flags); + rc =3D 0; break; case VIR_DOMAIN_DEVICE_PANIC: virDomainPanicDefFormat(&buf, src->data.panic); --=20 2.34.1