vpnor: Honour return codes in reset_lpc()
Without inspecting the return codes we have no way to communicate up the
call stack whether the operation was successful.
Change-Id: If8af2995522901ec8fcfc571cf1393b0441f8c9a
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
diff --git a/vpnor/mboxd_lpc_reset.cpp b/vpnor/mboxd_lpc_reset.cpp
index 60ce0d3..9bcbb89 100644
--- a/vpnor/mboxd_lpc_reset.cpp
+++ b/vpnor/mboxd_lpc_reset.cpp
@@ -29,8 +29,17 @@
*/
int reset_lpc(struct mbox_context *context)
{
+ int rc;
+
destroy_vpnor(context);
- init_vpnor(context);
- vpnor_copy_bootloader_partition(context);
+
+ rc = init_vpnor(context);
+ if (rc < 0)
+ return rc;
+
+ rc = vpnor_copy_bootloader_partition(context);
+ if (rc < 0)
+ return rc;
+
return point_to_memory(context);
}