Add additional error handling to pcidev_readbar() callers

This is mostly a leftover of Niklas' "remove exit call from pcidev_init" patch.
While not explicitly necessary detecting errors early is usually a good idea.

Corresponding to flashrom svn r1718.

Signed-off-by: Niklas Söderlund <>
Signed-off-by: Stefan Tauner <>
Acked-by: Stefan Tauner <>
diff --git a/nicnatsemi.c b/nicnatsemi.c
index d62a73f..cb8da6d 100644
--- a/nicnatsemi.c
+++ b/nicnatsemi.c
@@ -64,6 +64,8 @@
 		return 1;
 	io_base_addr = pcidev_readbar(dev, PCI_BASE_ADDRESS_0);
+	if (!io_base_addr)
+		return 1;
 	/* The datasheet shows address lines MA0-MA16 in one place and MA0-MA15
 	 * in another. My NIC has MA16 connected to A16 on the boot ROM socket