diff options
| author | Michael Brown | 2011-01-11 02:37:27 +0100 |
|---|---|---|
| committer | Michael Brown | 2011-01-19 14:52:55 +0100 |
| commit | 267ef3179177cc345e5c1a550cd187a6e5cc8e69 (patch) | |
| tree | 7de20f107dd50bc3bd6d72dd99b0b8ad68266a2f /src/drivers | |
| parent | [nvo] Allow resizing of non-volatile stored option blocks (diff) | |
| download | ipxe-267ef3179177cc345e5c1a550cd187a6e5cc8e69.tar.gz ipxe-267ef3179177cc345e5c1a550cd187a6e5cc8e69.tar.xz ipxe-267ef3179177cc345e5c1a550cd187a6e5cc8e69.zip | |
[pci] Allow pci_vpd_init() return status to be ignored
Most xxx_init() functions are void functions with no failure cases.
Allow pci_vpd_init() to be used in the same way. (Subsequent calls to
pci_vpd_read() etc. will fail if pci_vpd_init() fails.)
Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/drivers')
| -rw-r--r-- | src/drivers/bus/pcivpd.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/drivers/bus/pcivpd.c b/src/drivers/bus/pcivpd.c index 1f7d832b9..1ee6c6415 100644 --- a/src/drivers/bus/pcivpd.c +++ b/src/drivers/bus/pcivpd.c @@ -73,6 +73,10 @@ static int pci_vpd_read_dword ( struct pci_vpd *vpd, int address, unsigned int retries; uint16_t flag; + /* Fail if no VPD present */ + if ( ! cap ) + return -ENOTTY; + /* Return cached value, if present */ if ( pci_vpd_cache_is_valid ( vpd ) && ( vpd->cache.address == address ) ) { @@ -127,6 +131,10 @@ static int pci_vpd_write_dword ( struct pci_vpd *vpd, int address, unsigned int retries; uint16_t flag; + /* Fail if no VPD present */ + if ( ! cap ) + return -ENOTTY; + /* Invalidate cache */ pci_vpd_invalidate_cache ( vpd ); |
