From nobody Sat Apr 27 00:15:19 2024 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=1652363971; cv=none; d=zohomail.com; s=zohoarc; b=BTf8HNYbAVsrw4JjA5YW4HC5Rt6qaO8fl+MJqUmk/H49UAUJ3njji64RycWBsdgOZuj9cDajbnA1obPZFN7wmzGLnTSVOHHBxIlU9BQjWCC2XPJqvjITicH6DVr1SRASoEkXPvZL/dsNYBVe7s64SfMzxW2yN0W3jJotu/Ucoes= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1652363971; h=Content-Type:Content-Transfer-Encoding:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=hfwzD+Cn39/+rgGBzRnq/oNgSvKUXg6ygWQ1g9rmNB4=; b=kZrauzIQSSAko3oWoQZ7VlA6mKWaXlACQS1h4kYgy+j3mg/t+NGuMglhVgcrWuNNmtwbmIMR0dpjSkbbPO18YVci6Zfb7h4BqLNG3bshu3qD0jUogxfFcWL2y+TKA+UryLRFaMEzwmGzJudk9XZJuuRc1DBR651QECISb3Pnl7Q= 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 1652363971661681.0028360720448; Thu, 12 May 2022 06:59:31 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-609-VXgKhowtPXmZAxg8Ni9_gQ-1; Thu, 12 May 2022 09:59:26 -0400 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 7A8033C11745; Thu, 12 May 2022 13:59:24 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1729B41617C; Thu, 12 May 2022 13:59:23 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id A5049194F4BF; Thu, 12 May 2022 13:59:22 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id F37E51947058 for ; Thu, 12 May 2022 13:59:20 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id E3370C4C7A5; Thu, 12 May 2022 13:59:20 +0000 (UTC) Received: from maggie.redhat.com (unknown [10.43.2.180]) by smtp.corp.redhat.com (Postfix) with ESMTP id 895A4C4C7A4 for ; Thu, 12 May 2022 13:59:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1652363970; 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:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=hfwzD+Cn39/+rgGBzRnq/oNgSvKUXg6ygWQ1g9rmNB4=; b=W4jidMCeAi64VN5CoQW1vI/2Sc8gqJ7PGDWvi/4cvAzlTOcEQTomu/XjxC5tgQWNFpUmIw LF77I817KMjrXH22askNycHAOxSQbmg7oGEsFRCtc+IgTSUyDvduv7Y7LajENRuTfLdByA yft5cepJAoqlNfmoWHu3beCVopvzN2E= X-MC-Unique: VXgKhowtPXmZAxg8Ni9_gQ-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH] qemu: Don't check for qemuDomainManagedSavePath() retval Date: Thu, 12 May 2022 15:59:16 +0200 Message-Id: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.85 on 10.11.54.8 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 2.85 on 10.11.54.10 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: 1652363972908100001 Content-Type: text/plain; charset="utf-8"; x-default="true" The qemuDomainManagedSavePath() function does no more than a g_strdup_printf() and as such can't return NULL really. Therefore, don't check for its return value. Signed-off-by: Michal Privoznik Reviewed-by: Peter Krempa --- src/qemu/qemu_driver.c | 25 ++++++------------------- 1 file changed, 6 insertions(+), 19 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 41c6836390..edba400a7b 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -2904,8 +2904,7 @@ qemuDomainManagedSave(virDomainPtr dom, unsigned int = flags) "save", false)) <= 0) goto cleanup; =20 - if (!(name =3D qemuDomainManagedSavePath(driver, vm))) - goto cleanup; + name =3D qemuDomainManagedSavePath(driver, vm); =20 VIR_INFO("Saving state of domain '%s' to '%s'", vm->def->name, name); =20 @@ -2926,19 +2925,15 @@ qemuDomainManagedSaveLoad(virDomainObj *vm, { virQEMUDriver *driver =3D opaque; g_autofree char *name =3D NULL; - int ret =3D -1; =20 virObjectLock(vm); =20 - if (!(name =3D qemuDomainManagedSavePath(driver, vm))) - goto cleanup; + name =3D qemuDomainManagedSavePath(driver, vm); =20 vm->hasManagedSave =3D virFileExists(name); =20 - ret =3D 0; - cleanup: virObjectUnlock(vm); - return ret; + return 0; } =20 =20 @@ -2979,8 +2974,7 @@ qemuDomainManagedSaveRemove(virDomainPtr dom, unsigne= d int flags) if (virDomainManagedSaveRemoveEnsureACL(dom->conn, vm->def) < 0) goto cleanup; =20 - if (!(name =3D qemuDomainManagedSavePath(driver, vm))) - goto cleanup; + name =3D qemuDomainManagedSavePath(driver, vm); =20 if (unlink(name) < 0) { virReportSystemError(errno, @@ -6079,8 +6073,7 @@ qemuDomainManagedSaveGetXMLDesc(virDomainPtr dom, uns= igned int flags) if (virDomainManagedSaveGetXMLDescEnsureACL(dom->conn, vm->def, flags)= < 0) goto cleanup; =20 - if (!(path =3D qemuDomainManagedSavePath(driver, vm))) - goto cleanup; + path =3D qemuDomainManagedSavePath(driver, vm); =20 if (!virFileExists(path)) { virReportError(VIR_ERR_OPERATION_INVALID, "%s", @@ -6117,8 +6110,7 @@ qemuDomainManagedSaveDefineXML(virDomainPtr dom, cons= t char *dxml, if (virDomainManagedSaveDefineXMLEnsureACL(conn, vm->def) < 0) goto cleanup; =20 - if (!(path =3D qemuDomainManagedSavePath(driver, vm))) - goto cleanup; + path =3D qemuDomainManagedSavePath(driver, vm); =20 if (!virFileExists(path)) { virReportError(VIR_ERR_OPERATION_INVALID, "%s", @@ -6427,9 +6419,6 @@ qemuDomainObjStart(virConnectPtr conn, */ managed_save =3D qemuDomainManagedSavePath(driver, vm); =20 - if (!managed_save) - return ret; - if (virFileExists(managed_save)) { if (force_boot) { if (unlink(managed_save) < 0) { @@ -6690,8 +6679,6 @@ qemuDomainUndefineFlags(virDomainPtr dom, } =20 name =3D qemuDomainManagedSavePath(driver, vm); - if (name =3D=3D NULL) - goto endjob; =20 if (virFileExists(name)) { if (flags & VIR_DOMAIN_UNDEFINE_MANAGED_SAVE) { --=20 2.35.1