dummyflasher: fix propagation of register_*_master() return values

This patch checks return value of register_*_master()
so that in case of an error this error is not ignored anymore.

Change-Id: I3a7eeb3cdd814db18b0717ae8b40ecadb4c32f7c
Signed-off-by: Alexander Goncharov <chat@joursoir.net>
Original-Reviewed-on: https://review.coreboot.org/c/flashrom/+/72430
Original-Reviewed-by: Anastasia Klimchuk <aklm@chromium.org>
Reviewed-on: https://review.coreboot.org/c/flashrom-stable/+/73477
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Nico Huber <nico.h@gmx.de>
diff --git a/dummyflasher.c b/dummyflasher.c
index 9ac83b6..0195fbd 100644
--- a/dummyflasher.c
+++ b/dummyflasher.c
@@ -434,6 +434,7 @@
 
 static int dummy_init(void)
 {
+	int ret = 0;
 	struct stat image_stat;
 
 	struct emu_data *data = calloc(1, sizeof(*data));
@@ -496,13 +497,13 @@
 		return 1;
 	}
 	if (dummy_buses_supported & BUS_NONSPI)
-		register_par_master(&par_master_dummyflasher,
-				    dummy_buses_supported & BUS_NONSPI,
-				    data);
+		ret |= register_par_master(&par_master_dummyflasher,
+					   dummy_buses_supported & BUS_NONSPI,
+					   data);
 	if (dummy_buses_supported & BUS_SPI)
-		register_spi_master(&spi_master_dummyflasher, data);
+		ret |= register_spi_master(&spi_master_dummyflasher, data);
 
-	return 0;
+	return ret;
 }
 
 static void *dummy_map(const char *descr, uintptr_t phys_addr, size_t len)