drivers: stepper: tmc5041: fix cid issues
fix cid issues related to unchecked return values. Signed-off-by: Jilay Pandya <jilay.pandya@outlook.com>
This commit is contained in:
parent
de1643d8fb
commit
92fce644e5
1 changed files with 11 additions and 3 deletions
|
@ -191,8 +191,13 @@ static void rampstat_work_handler(struct k_work *work)
|
||||||
uint32_t drv_status;
|
uint32_t drv_status;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
tmc5041_read(stepper_config->controller, TMC5041_DRVSTATUS(stepper_config->index),
|
err = tmc5041_read(stepper_config->controller, TMC5041_DRVSTATUS(stepper_config->index),
|
||||||
&drv_status);
|
&drv_status);
|
||||||
|
if (err != 0) {
|
||||||
|
LOG_ERR("%s: Failed to read DRVSTATUS register", stepper_data->stepper->name);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (FIELD_GET(TMC5XXX_DRV_STATUS_SG_STATUS_MASK, drv_status) == 1U) {
|
if (FIELD_GET(TMC5XXX_DRV_STATUS_SG_STATUS_MASK, drv_status) == 1U) {
|
||||||
LOG_INF("%s: Stall detected", stepper_data->stepper->name);
|
LOG_INF("%s: Stall detected", stepper_data->stepper->name);
|
||||||
err = tmc5041_write(stepper_config->controller,
|
err = tmc5041_write(stepper_config->controller,
|
||||||
|
@ -453,7 +458,10 @@ static int tmc5041_stepper_set_target_position(const struct device *dev, const i
|
||||||
if (err != 0) {
|
if (err != 0) {
|
||||||
return -EIO;
|
return -EIO;
|
||||||
}
|
}
|
||||||
tmc5041_write(config->controller, TMC5041_XTARGET(config->index), position);
|
err = tmc5041_write(config->controller, TMC5041_XTARGET(config->index), position);
|
||||||
|
if (err != 0) {
|
||||||
|
return -EIO;
|
||||||
|
}
|
||||||
|
|
||||||
if (config->is_sg_enabled) {
|
if (config->is_sg_enabled) {
|
||||||
k_work_reschedule(&data->stallguard_dwork,
|
k_work_reschedule(&data->stallguard_dwork,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue