From nobody Mon Feb 9 11:33:12 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; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.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=1621601467; cv=none; d=zohomail.com; s=zohoarc; b=m/X2hNM8286pfsIfsYGOjHhK9EOIKeVZNhjPJFwMaKa/t8UYd0qOZ3miZqZtJrrZLdbysAcv7D5BJIf9/t8WDyIQvsOfcV11Rg8izNGWC6YQ4yDPrNh16xTLMZPQsIwn4mcq/nJbBpYKzCuN4TPBMoCIvYP8WPQ7NPv6r+qoq8M= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1621601467; 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=QLXSkg++ubEPJe5p3A6xDWDMPkWISwb1dafXzPgRfM0=; b=drW1Gz2YtDbqmMbR/DndoVI/RoKnIVfDQ6Mzwn5pfhOT5ppP9lN5KKFYCAzkB44dRslUrd5YV7+MWuR0BKdILtbyaT8xpVevvCUqXNUK1V4XAyB+RGWRk4KrxTDKYU9NraDiLk4BlNn2SyICmw6ZcAkZV+cD6FUo5rUx7sodi98= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass 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 1621601467181399.8316734214609; Fri, 21 May 2021 05:51:07 -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-315-LSOZPABGN1edTG5Js2NBTg-1; Fri, 21 May 2021 08:48:29 -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 095EBA40DD; Fri, 21 May 2021 12:48:23 +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 D8DED50415; Fri, 21 May 2021 12:48:22 +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 AA174180B464; Fri, 21 May 2021 12:48:22 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 14LCmLSV031409 for ; Fri, 21 May 2021 08:48:21 -0400 Received: by smtp.corp.redhat.com (Postfix) id 45A98421F; Fri, 21 May 2021 12:48:21 +0000 (UTC) Received: from speedmetal.lan (unknown [10.40.208.14]) by smtp.corp.redhat.com (Postfix) with ESMTP id ADD5969FB4 for ; Fri, 21 May 2021 12:48:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1621601466; 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=QLXSkg++ubEPJe5p3A6xDWDMPkWISwb1dafXzPgRfM0=; b=Lq9DhO/phAZ5ZqErz8iA0bdzEn5lcQHMj/UapskGaCzy65jgR71T7UYR3ZQvWEnA4bTW76 oAyPiEa+2Ve+F6FF4XOHFLu1XPCOusjlvbkciZYNS3GsFfsieWOhjyp7evMyvarBBSdFDx pB0rrxDQ6IWmgkLOe1/i+1ls7BW8x80= X-MC-Unique: LSOZPABGN1edTG5Js2NBTg-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 25/35] qemuDomainAttachDiskGeneric: Refactor cleanup Date: Fri, 21 May 2021 14:47:25 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 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) Content-Type: text/plain; charset="utf-8" Remove the 'ret' variable and 'cleanup' label in favor of directly returning the value since we don't have anything under the 'cleanup:' label. Signed-off-by: Peter Krempa --- src/qemu/qemu_hotplug.c | 30 ++++++++++++------------------ 1 file changed, 12 insertions(+), 18 deletions(-) diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index b1d3ee8e7a..25e845dc83 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -696,22 +696,21 @@ qemuDomainAttachDiskGeneric(virQEMUDriver *driver, virDomainDiskDef *disk) { g_autoptr(qemuBlockStorageSourceChainData) data =3D NULL; - int ret =3D -1; qemuDomainObjPrivate *priv =3D vm->privateData; g_autofree char *devstr =3D NULL; bool blockdev =3D virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV); if (virStorageSourceGetActualType(disk->src) =3D=3D VIR_STORAGE_TYPE_V= HOST_USER) { if (!(data =3D qemuBuildStorageSourceChainAttachPrepareChardev(dis= k))) - goto cleanup; + return -1; } else if (blockdev) { if (!(data =3D qemuBuildStorageSourceChainAttachPrepareBlockdev(di= sk->src, priv= ->qemuCaps))) - goto cleanup; + return -1; if (disk->copy_on_read =3D=3D VIR_TRISTATE_SWITCH_ON) { if (!(data->copyOnReadProps =3D qemuBlockStorageGetCopyOnReadP= rops(disk))) - goto cleanup; + return -1; data->copyOnReadNodename =3D g_strdup(QEMU_DOMAIN_DISK_PRIVATE= (disk)->nodeCopyOnRead); } @@ -719,14 +718,14 @@ qemuDomainAttachDiskGeneric(virQEMUDriver *driver, } else { if (!(data =3D qemuBuildStorageSourceChainAttachPrepareDrive(disk, priv->q= emuCaps))) - goto cleanup; + return -1; } if (!(devstr =3D qemuBuildDiskDeviceStr(vm->def, disk, priv->qemuCaps)= )) - goto cleanup; + return -1; if (qemuHotplugAttachManagedPR(driver, vm, disk->src, QEMU_ASYNC_JOB_N= ONE) < 0) - goto cleanup; + return -1; qemuDomainObjEnterMonitor(driver, vm); @@ -756,27 +755,22 @@ qemuDomainAttachDiskGeneric(virQEMUDriver *driver, VIR_WARN("failed to set blkdeviotune for '%s' of '%s'", disk->= dst, vm->def->name); } - if (qemuDomainObjExitMonitor(driver, vm) < 0) { - ret =3D -2; - goto cleanup; - } - - ret =3D 0; + if (qemuDomainObjExitMonitor(driver, vm) < 0) + return -2; - cleanup: - return ret; + return 0; exit_monitor: qemuBlockStorageSourceChainDetach(priv->mon, data); if (qemuDomainObjExitMonitor(driver, vm) < 0) - ret =3D -2; + return -2; if (virStorageSourceChainHasManagedPR(disk->src) && qemuHotplugRemoveManagedPR(driver, vm, QEMU_ASYNC_JOB_NONE) < 0) - ret =3D -2; + return -2; - goto cleanup; + return -1; } --=20 2.31.1