par_master: Use new API to register shutdown function

This allows par masters to register shutdown function in par_master
struct, which means there is no need to call register_shutdown in init
function, since this call is now a part of register_par_master.

As a consequence of using new API, this patch also fixes propagation
of register_par_master() return values.

Tested: builds and ninja test

Change-Id: Ief7be907f53878b4b6567b52889735e5fff64ead
Signed-off-by: Anastasia Klimchuk <aklm@chromium.org>
Original-Reviewed-on: https://review.coreboot.org/c/flashrom/+/57156
Original-Reviewed-by: Nico Huber <nico.h@gmx.de>
Reviewed-on: https://review.coreboot.org/c/flashrom-stable/+/72233
Reviewed-by: Nico Huber <nico.h@gmx.de>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
diff --git a/nic3com.c b/nic3com.c
index ffebe8a..27e3c57 100644
--- a/nic3com.c
+++ b/nic3com.c
@@ -57,6 +57,7 @@
 				chipaddr addr);
 static uint8_t nic3com_chip_readb(const struct flashctx *flash,
 				  const chipaddr addr);
+static int nic3com_shutdown(void *data);
 static const struct par_master par_master_nic3com = {
 	.chip_readb	= nic3com_chip_readb,
 	.chip_readw	= fallback_chip_readw,
@@ -66,6 +67,7 @@
 	.chip_writew	= fallback_chip_writew,
 	.chip_writel	= fallback_chip_writel,
 	.chip_writen	= fallback_chip_writen,
+	.shutdown	= nic3com_shutdown,
 };
 
 static int nic3com_shutdown(void *data)
@@ -116,13 +118,9 @@
 	 */
 	OUTW(SELECT_REG_WINDOW + 0, io_base_addr + INT_STATUS);
 
-	if (register_shutdown(nic3com_shutdown, NULL))
-		return 1;
-
 	max_rom_decode.parallel = 128 * 1024;
-	register_par_master(&par_master_nic3com, BUS_PARALLEL, NULL);
 
-	return 0;
+	return register_par_master(&par_master_nic3com, BUS_PARALLEL, NULL);
 }
 
 static void nic3com_chip_writeb(const struct flashctx *flash, uint8_t val,