Diff between 7a0a07704b7063827e98d4dc0022d2b4a41adfbb and 385e1e4f255e5c6eda976267e55956a24a9d7194

Changed Files

File Additions Deletions Status
android/hal-bluetooth.c +2 -5 modified
android/hal-ipc.c +6 -0 modified

Full Patch

diff --git a/android/hal-bluetooth.c b/android/hal-bluetooth.c
index f408a7d..5b07070 100644
--- a/android/hal-bluetooth.c
+++ b/android/hal-bluetooth.c
@@ -40,7 +40,6 @@ static bool interface_ready(void)
 static int init(bt_callbacks_t *callbacks)
 {
 	struct hal_msg_cmd_register_module cmd;
-	struct hal_msg_rsp_error rsp;
 
 	DBG("");
 
@@ -55,8 +54,7 @@ static int init(bt_callbacks_t *callbacks)
 	cmd.service_id = HAL_SERVICE_ID_BLUETOOTH;
 
 	if (hal_ipc_cmd(HAL_SERVICE_ID_CORE, HAL_MSG_OP_REGISTER_MODULE,
-						sizeof(cmd), &cmd,
-						sizeof(rsp), &rsp, NULL) < 0) {
+				sizeof(cmd), &cmd, 0, NULL, NULL) < 0) {
 		error("Failed to register 'bluetooth' service");
 		goto fail;
 	}
@@ -64,8 +62,7 @@ static int init(bt_callbacks_t *callbacks)
 	cmd.service_id = HAL_SERVICE_ID_SOCK;
 
 	if (hal_ipc_cmd(HAL_SERVICE_ID_CORE, HAL_MSG_OP_REGISTER_MODULE,
-						sizeof(cmd), &cmd,
-						sizeof(rsp), &rsp, NULL) < 0) {
+				sizeof(cmd), &cmd, 0, NULL, NULL) < 0) {
 		error("Failed to register 'socket' service");
 		goto fail;
 	}
diff --git a/android/hal-ipc.c b/android/hal-ipc.c
index 5b77adf..8d40271 100644
--- a/android/hal-ipc.c
+++ b/android/hal-ipc.c
@@ -146,10 +146,16 @@ int hal_ipc_cmd(uint8_t service_id, uint8_t opcode, uint16_t len, void *param,
 	struct iovec iv[2];
 	struct hal_msg_hdr hal_msg;
 	char cmsgbuf[CMSG_SPACE(sizeof(int))];
+	struct hal_msg_rsp_error err;
 
 	if (cmd_sk < 0)
 		return -EBADF;
 
+	if (!rsp || rsp_len == 0) {
+		memset(&err, 0, sizeof(err));
+		rsp = &err;
+	}
+
 	memset(&msg, 0, sizeof(msg));
 	memset(&hal_msg, 0, sizeof(hal_msg));