Skip to contentSkip to conversation

pci-assign: Move "Invalid ROM" error message to pci-assign-load-rom.c

PATCH In review Lin Ma 2 participants 2 messages Jun 15, 2016 – Jun 16, 2016

lore
Share & tools
lore

Lin Ma

author
#0 lore raw

PATCH 1/1 pci-assign: Move "Invalid ROM" error message to pci-assign-load-rom.c

In function pci_assign_dev_load_option_rom, For those pci devices don't have 'rom' file under sysfs or if loading ROM from external file, The function returns NULL, and won't set the passed 'size' variable.

In these 2 cases, qemu still reports "Invalid ROM" error message, Users may be confused by it.

---
 hw/i386/kvm/pci-assign.c      | 4 ----
 hw/i386/pci-assign-load-rom.c | 3 +++
 2 files changed, 3 insertions(+), 4 deletions(-)
hw/i386/kvm/pci-assign.c +0 -4
index db2cbd2..07d14f9 100644
@@ -1892,8 +1892,4 @@ static void assigned_dev_load_option_rom(AssignedDevice *dev)
     pci_assign_dev_load_option_rom(&dev->dev, OBJECT(dev), &size,
                                    dev->host.domain, dev->host.bus,
                                    dev->host.slot, dev->host.function);
-
-    if (!size) {
-        error_report("pci-assign: Invalid ROM.");
-    }
 }
hw/i386/pci-assign-load-rom.c +3 -0
index 4bbb08c..0d8e4b2 100644
@@ -40,6 +40,9 @@ void *pci_assign_dev_load_option_rom(PCIDevice *dev, struct Object *owner,
              domain, bus, slot, function);
 
     if (stat(rom_file, &st)) {
+        if (errno != ENOENT) {
+            error_report("pci-assign: Invalid ROM.");
+        }
         return NULL;
     }
 
Signature · 1 line
2.8.1
#1 lore raw
Quoted 32 lines · Lin Ma

In function pci_assign_dev_load_option_rom, For those pci devices don't have 'rom' file under sysfs or if loading ROM from external file, The function returns NULL, and won't set the passed 'size' variable.

In these 2 cases, qemu still reports "Invalid ROM" error message, Users may be confused by it.

---
 hw/i386/kvm/pci-assign.c      | 4 ----
 hw/i386/pci-assign-load-rom.c | 3 +++
 2 files changed, 3 insertions(+), 4 deletions(-)
hw/i386/kvm/pci-assign.c +0 -4
index db2cbd2..07d14f9 100644
@@ -1892,8 +1892,4 @@ static void assigned_dev_load_option_rom(AssignedDevice *dev)
     pci_assign_dev_load_option_rom(&dev->dev, OBJECT(dev), &size,
                                    dev->host.domain, dev->host.bus,
                                    dev->host.slot, dev->host.function);
-
-    if (!size) {
-        error_report("pci-assign: Invalid ROM.");
-    }
 }
hw/i386/pci-assign-load-rom.c +0 -0
index 4bbb08c..0d8e4b2 100644

hw/i386/pci-assign-load-rom.c void *pci_assign_dev_load_option_rom(PCIDevice *dev, struct Object *owner, · line 48

Quoted 9 lines
hw/i386/pci-assign-load-rom.c +3 -0
@@ -40,6 +40,9 @@ void *pci_assign_dev_load_option_rom(PCIDevice *dev, struct Object *owner,
              domain, bus, slot, function);
 
     if (stat(rom_file, &st)) {
+        if (errno != ENOENT) {
+            error_report("pci-assign: Invalid ROM.");
+        }
         return NULL;
     }
 

It missed today's pull request, but it's queued.

Thanks,

Paolo