dediprog.c: Split up compound conditional and swap two operations

register_spi_master now becomes the last operation in init function,
which is consistent with other spi masters.

In addition, the patch fixes propagation of register_spi_master return
values, which is also consistent with other spi masters.

Tested: ninja test

Change-Id: Ib7e0179da39279e32a8497466b044b69ec836da8
Signed-off-by: Angel Pons <th3fanbus@gmail.com>
Signed-off-by: Anastasia Klimchuk <aklm@chromium.org>
Original-Reviewed-on: https://review.coreboot.org/c/flashrom/+/51706
Original-Reviewed-by: Nico Huber <nico.h@gmx.de>
Reviewed-on: https://review.coreboot.org/c/flashrom-stable/+/71427
Reviewed-by: Nico Huber <nico.h@gmx.de>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
diff --git a/dediprog.c b/dediprog.c
index aa827c1..7699d6d 100644
--- a/dediprog.c
+++ b/dediprog.c
@@ -1302,11 +1302,11 @@
 	if (register_shutdown(dediprog_shutdown, dp_data))
 		goto init_err_cleanup_exit;
 
-	spi_master_dediprog.data = dp_data;
-	if (register_spi_master(&spi_master_dediprog) || dediprog_set_leds(LED_NONE, dp_data))
-		return 1; /* shutdown function does cleanup */
+	if (dediprog_set_leds(LED_NONE, dp_data))
+		goto init_err_cleanup_exit;
 
-	return 0;
+	spi_master_dediprog.data = dp_data;
+	return register_spi_master(&spi_master_dediprog);
 
 init_err_cleanup_exit:
 	dediprog_shutdown(dp_data);