From ad38ef7333d614cee39aedc67163d5d3ab2bc124 Mon Sep 17 00:00:00 2001 From: Gaetan Perrot Date: Wed, 2 Jul 2025 16:27:35 +0900 Subject: [PATCH] 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 --- drivers/counter/counter_ifx_cat1.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/counter/counter_ifx_cat1.c b/drivers/counter/counter_ifx_cat1.c index 76fcbc21c8e..cd1068aba46 100644 --- a/drivers/counter/counter_ifx_cat1.c +++ b/drivers/counter/counter_ifx_cat1.c @@ -189,10 +189,8 @@ static int ifx_cat1_counter_init(const struct device *dev) rslt = cyhal_gpio_enable_output(config->external_pin, CYHAL_SIGNAL_TYPE_EDGE, (cyhal_source_t *)&data->signal_source); if (rslt != CY_RSLT_SUCCESS) { - if (rslt != CY_RSLT_SUCCESS) { - LOG_ERR("error in the enabling of Counter input pin output"); - return -EIO; - } + LOG_ERR("error in the enabling of Counter input pin output"); + return -EIO; } rslt = cyhal_timer_connect_digital(&data->counter_obj, data->signal_source,