Browse Source

drivers: counter: Fix redundant identical condition

There was an unnecessary nested `if` in `ifx_cat1_counter_init` with the
same condition already checked in the outer block.

This results in dead and redundant code with no functional impact but
harms readability.

The inner `if (rslt != CY_RSLT_SUCCESS)` was removed to clean up the
function.

Signed-off-by: Gaetan Perrot <gaetan.perrot@spacecubics.com>
pull/91826/merge
Gaetan Perrot 7 days ago committed by Daniel DeGrasse
parent
commit
ad38ef7333
  1. 2
      drivers/counter/counter_ifx_cat1.c

2
drivers/counter/counter_ifx_cat1.c

@ -188,12 +188,10 @@ static int ifx_cat1_counter_init(const struct device *dev)
rslt = cyhal_gpio_enable_output(config->external_pin, CYHAL_SIGNAL_TYPE_EDGE, rslt = cyhal_gpio_enable_output(config->external_pin, CYHAL_SIGNAL_TYPE_EDGE,
(cyhal_source_t *)&data->signal_source); (cyhal_source_t *)&data->signal_source);
if (rslt != CY_RSLT_SUCCESS) {
if (rslt != CY_RSLT_SUCCESS) { if (rslt != CY_RSLT_SUCCESS) {
LOG_ERR("error in the enabling of Counter input pin output"); LOG_ERR("error in the enabling of Counter input pin output");
return -EIO; return -EIO;
} }
}
rslt = cyhal_timer_connect_digital(&data->counter_obj, data->signal_source, rslt = cyhal_timer_connect_digital(&data->counter_obj, data->signal_source,
CYHAL_TIMER_INPUT_COUNT); CYHAL_TIMER_INPUT_COUNT);

Loading…
Cancel
Save