drivers: gnss: u-blox_m8: fix mutex leak
Properly release script.lock in case of error. Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
This commit is contained in:
parent
e7d6a40282
commit
09961c635a
1 changed files with 4 additions and 3 deletions
|
@ -126,14 +126,15 @@ static int ubx_m8_msg_get(const struct device *dev, const struct ubx_frame *req,
|
||||||
|
|
||||||
err = modem_ubx_run_script(&data->ubx.inst, &data->script.inst);
|
err = modem_ubx_run_script(&data->ubx.inst, &data->script.inst);
|
||||||
if (err != 0 || (data->script.inst.response.buf_len < UBX_FRAME_SZ(min_rsp_size))) {
|
if (err != 0 || (data->script.inst.response.buf_len < UBX_FRAME_SZ(min_rsp_size))) {
|
||||||
return -EIO;
|
err = -EIO;
|
||||||
|
goto unlock_return;
|
||||||
}
|
}
|
||||||
|
|
||||||
memcpy(rsp, rsp_frame->payload_and_checksum, min_rsp_size);
|
memcpy(rsp, rsp_frame->payload_and_checksum, min_rsp_size);
|
||||||
|
|
||||||
|
unlock_return:
|
||||||
(void)k_mutex_unlock(&data->script.lock);
|
(void)k_mutex_unlock(&data->script.lock);
|
||||||
|
return err;
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int ubx_m8_msg_send(const struct device *dev, const struct ubx_frame *req,
|
static int ubx_m8_msg_send(const struct device *dev, const struct ubx_frame *req,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue