]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu_firmware: Drop 'nvram' local variable
authorAndrea Bolognani <abologna@redhat.com>
Sun, 28 Dec 2025 17:31:38 +0000 (18:31 +0100)
committerAndrea Bolognani <abologna@redhat.com>
Thu, 8 Jan 2026 22:54:18 +0000 (23:54 +0100)
We access the NVRAM information via the 'loader' local variable
throughout the file, and this is the only spot where the 'nvram'
local variable exists. It makes things inconsistent and opens up
the possibility of the values for 'loader' and 'nvram' going out
of sync, especially after a future commit will introduce the
need to set the former. Just get rid of the additional variable.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
src/qemu/qemu_firmware.c

index b168ec7cf70b890df50a552ff347beeaf11969d8..903b0a984da3475b5ad8c8b843a179c7c1b96a98 100644 (file)
@@ -1780,7 +1780,6 @@ qemuFirmwareFillDomain(virQEMUDriver *driver,
                        bool abiUpdate)
 {
     virDomainLoaderDef *loader = def->os.loader;
-    virStorageSource *nvram = loader ? loader->nvram : NULL;
     bool autoSelection = (def->os.firmware != VIR_DOMAIN_OS_DEF_FIRMWARE_NONE);
     int ret;
 
@@ -1804,13 +1803,14 @@ qemuFirmwareFillDomain(virQEMUDriver *driver,
                        virStorageFileFormatTypeToString(loader->format));
         return -1;
     }
-    if (nvram &&
-        nvram->format &&
-        nvram->format != VIR_STORAGE_FILE_RAW &&
-        nvram->format != VIR_STORAGE_FILE_QCOW2) {
+    if (loader &&
+        loader->nvram &&
+        loader->nvram->format &&
+        loader->nvram->format != VIR_STORAGE_FILE_RAW &&
+        loader->nvram->format != VIR_STORAGE_FILE_QCOW2) {
         virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                        _("Unsupported nvram format '%1$s'"),
-                       virStorageFileFormatTypeToString(nvram->format));
+                       virStorageFileFormatTypeToString(loader->nvram->format));
         return -1;
     }