From 77a7cb3e4f017eb805f2af057177fd9dcb4bd709 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20G=C5=82=C4=85bek?= Date: Mon, 26 May 2025 12:59:11 +0200 Subject: [PATCH] drivers: clock_control_nrf: Prevent break from becoming dead code MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When both NRF_CLOCK_HAS_XO_TUNE and NRF_CLOCK_HAS_PLL evaluate to 0, one break statement can end up not associated with any case and become dead code. Refactor a bit the related switch to avoid such situation. Signed-off-by: Andrzej Głąbek --- drivers/clock_control/clock_control_nrf.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/drivers/clock_control/clock_control_nrf.c b/drivers/clock_control/clock_control_nrf.c index d148cd49e4e..1073b05e167 100644 --- a/drivers/clock_control/clock_control_nrf.c +++ b/drivers/clock_control/clock_control_nrf.c @@ -692,6 +692,10 @@ static void clock_event_handler(nrfx_clock_evt_type_t event) case NRFX_CLOCK_EVT_XO_TUNED: clkstarted_handle(dev, CLOCK_CONTROL_NRF_TYPE_HFCLK); break; + case NRFX_CLOCK_EVT_XO_TUNE_ERROR: + case NRFX_CLOCK_EVT_XO_TUNE_FAILED: + /* No processing needed. */ + break; case NRFX_CLOCK_EVT_HFCLK_STARTED: /* HFCLK is stable after XOTUNED event. * HFCLK_STARTED means only that clock has been started. @@ -743,15 +747,9 @@ static void clock_event_handler(nrfx_clock_evt_type_t event) #endif #if NRF_CLOCK_HAS_PLL case NRFX_CLOCK_EVT_PLL_STARTED: -#endif -#if NRF_CLOCK_HAS_XO_TUNE - case NRFX_CLOCK_EVT_XO_TUNE_ERROR: - case NRFX_CLOCK_EVT_XO_TUNE_FAILED: -#endif - { - /* unhandled event */ + /* No processing needed. */ break; - } +#endif default: __ASSERT_NO_MSG(0); break;