Skip to content

Commit ad38ef7

Browse files
moonlight83340danieldegrasse
authored andcommitted
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 <[email protected]>
1 parent f1c27b6 commit ad38ef7

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

drivers/counter/counter_ifx_cat1.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -189,10 +189,8 @@ static int ifx_cat1_counter_init(const struct device *dev)
189189
rslt = cyhal_gpio_enable_output(config->external_pin, CYHAL_SIGNAL_TYPE_EDGE,
190190
(cyhal_source_t *)&data->signal_source);
191191
if (rslt != CY_RSLT_SUCCESS) {
192-
if (rslt != CY_RSLT_SUCCESS) {
193-
LOG_ERR("error in the enabling of Counter input pin output");
194-
return -EIO;
195-
}
192+
LOG_ERR("error in the enabling of Counter input pin output");
193+
return -EIO;
196194
}
197195

198196
rslt = cyhal_timer_connect_digital(&data->counter_obj, data->signal_source,

0 commit comments

Comments
 (0)