Commit 4ef0c132 authored by Andrew Jeffery's avatar Andrew Jeffery

mboxd: Tidy up failure paths on daemon startup

Don't try to cleanup objects we haven't initialised.

Change-Id: I218ab785af36bc3a1d3085c9dcd575e812402433
Signed-off-by: Andrew Jeffery's avatarAndrew Jeffery <andrew@aj.id.au>
parent 81059e32
......@@ -402,38 +402,38 @@ int main(int argc, char **argv)
rc = init_signals(context, &set);
if (rc) {
goto finish;
goto cleanup_context;
}
rc = mboxd_backend_init(context);
if (rc) {
goto finish;
goto cleanup_context;
}
rc = protocol_init(context);
if (rc) {
goto finish;
goto cleanup_backend;
}
rc = transport_mbox_init(context, &mbox_ops);
if (rc) {
goto finish;
goto cleanup_protocol;
}
rc = lpc_dev_init(context);
if (rc) {
goto finish;
goto cleanup_mbox;
}
/* We've found the reserved memory region -> we can assign to windows */
rc = windows_init(context);
if (rc) {
goto finish;
goto cleanup_lpc;
}
rc = dbus_init(context, &dbus_ops);
if (rc) {
goto finish;
goto cleanup_windows;
}
/* Set the LPC bus mapping */
......@@ -446,12 +446,12 @@ int main(int argc, char **argv)
/* Alert on all supported transports */
rc = protocol_events_put(context, mbox_ops);
if (rc) {
goto finish;
goto cleanup;
}
rc = protocol_events_put(context, dbus_ops);
if (rc) {
goto finish;
goto cleanup;
}
MSG_INFO("Entering Polling Loop\n");
......@@ -459,7 +459,6 @@ int main(int argc, char **argv)
MSG_INFO("Exiting Poll Loop: %d\n", rc);
finish:
MSG_INFO("Daemon Exiting...\n");
context->bmc_events &= ~BMC_EVENT_DAEMON_READY;
context->bmc_events |= BMC_EVENT_PROTOCOL_RESET;
......@@ -468,12 +467,19 @@ finish:
protocol_events_put(context, mbox_ops);
protocol_events_put(context, dbus_ops);
cleanup:
dbus_free(context);
backend_free(&context->backend);
cleanup_windows:
windows_free(context);
cleanup_lpc:
lpc_dev_free(context);
cleanup_mbox:
transport_mbox_free(context);
windows_free(context);
cleanup_protocol:
protocol_free(context);
cleanup_backend:
backend_free(&context->backend);
cleanup_context:
free(context);
return rc;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment