PCI: return error on failure to read PCI ROMs

This patch makes the ROM reading code return an error to user space if
the size of the ROM read is equal to 0.

The patch also emits a warnings if the contents of the ROM are invalid,
and documents the effects of the "enable" file on ROM reading.

Signed-off-by: Timothy S. Nelson <wayland@wayland.id.au>
Acked-by: Alex Villacis-Lasso <a_villacis@palosanto.com>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
This commit is contained in:
Timothy S. Nelson
2009-01-30 06:12:47 +11:00
committed by Jesse Barnes
parent 3419c75e15
commit 97c44836cd
6 changed files with 22 additions and 9 deletions

View File

@ -768,8 +768,8 @@ pci_read_rom(struct kobject *kobj, struct bin_attribute *bin_attr,
return -EINVAL;
rom = pci_map_rom(pdev, &size); /* size starts out as PCI window size */
if (!rom)
return 0;
if (!rom || !size)
return -EIO;
if (off >= size)
count = 0;