Skip to content

Commit

Permalink
drivers: gnss: cleanup function returning
Browse files Browse the repository at this point in the history
Cleanup more returns and gotos as they are redundant.

Signed-off-by: Andreas Klinger <[email protected]>
  • Loading branch information
it-klinger authored and nashif committed Jul 27, 2024
1 parent f89f2ae commit 7c8033f
Showing 1 changed file with 1 addition and 17 deletions.
18 changes: 1 addition & 17 deletions drivers/gnss/gnss_u_blox_m10.c
Original file line number Diff line number Diff line change
Expand Up @@ -223,9 +223,6 @@ static int ubx_m10_modem_ubx_run_script(const struct device *dev,
}

ret = modem_ubx_run_script(&data->ubx, modem_ubx_script_tx);
if (ret < 0) {
goto reset_modem_module;
}

reset_modem_module:
ret |= ubx_m10_modem_module_change(dev, 1);
Expand Down Expand Up @@ -264,9 +261,6 @@ static int ubx_m10_modem_ubx_script_init(const struct device *dev, void *payload

ret = ubx_create_and_validate_frame(data->request_buf, sizeof(data->request_buf), msg_cls,
msg_id, payload, payld_sz);
if (ret < 0) {
return ret;
}

return ret;
}
Expand All @@ -289,9 +283,6 @@ static int ubx_m10_ubx_cfg_rate(const struct device *dev)
}

ret = ubx_m10_modem_ubx_run_script(dev, &(data->script));
if (ret < 0) {
goto unlock;
}

unlock:
k_spin_unlock(&data->lock, key);
Expand Down Expand Up @@ -325,9 +316,6 @@ static int ubx_m10_ubx_cfg_prt_set(const struct device *dev, uint32_t target_bau
* (in order to receive response as well), which we are not doing right now.
*/
ret = ubx_m10_modem_ubx_run_script(dev, &(data->script));
if (ret < 0) {
goto unlock;
}

unlock:
k_spin_unlock(&data->lock, key);
Expand Down Expand Up @@ -476,7 +464,7 @@ static int ubx_m10_configure_gnss_device_baudrate(const struct device *dev)

static int ubx_m10_configure_messages(const struct device *dev)
{
int ret;
int ret = 0;
k_spinlock_key_t key;
struct ubx_m10_data *data = dev->data;
struct ubx_cfg_msg_payload payload;
Expand Down Expand Up @@ -885,9 +873,6 @@ static int ubx_m10_set_fix_rate(const struct device *dev, uint32_t fix_interval_
}

ret = ubx_m10_modem_ubx_run_script(dev, &(data->script));
if (ret < 0) {
goto unlock;
}

unlock:
k_spin_unlock(&data->lock, key);
Expand Down Expand Up @@ -964,7 +949,6 @@ static int ubx_m10_configure(const struct device *dev)
ret = ubx_m10_configure_messages(dev);
if (ret < 0) {
LOG_ERR("Configuring messages failed. Returned %d.", ret);
goto reset;
}

reset:
Expand Down

0 comments on commit 7c8033f

Please sign in to comment.