This is an automated email from the ASF dual-hosted git repository.

xiaoxiang781216 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit 97c643b70620edd70dd1bdc85addc0d1bbb92991
Author: Kerogit <[email protected]>
AuthorDate: Thu Sep 10 22:25:49 2026 +0200

    boards/avr/avrdx/breadxavr: silence unused variable warning
    
    This patch silences a warning caused by unconditionally declared
    variable which is only used with specific configuration.
    
    Also, if the initialization fails, panic instead of returning.
    (This should not happen since the code runs in initialization
    phase but silently returning is not the correct action.)
    
    Signed-off-by: Kerogit <[email protected]>
---
 boards/avr/avrdx/breadxavr/src/avrdx_init.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/boards/avr/avrdx/breadxavr/src/avrdx_init.c 
b/boards/avr/avrdx/breadxavr/src/avrdx_init.c
index 096c1f9730b..9ca31d8a0ee 100644
--- a/boards/avr/avrdx/breadxavr/src/avrdx_init.c
+++ b/boards/avr/avrdx/breadxavr/src/avrdx_init.c
@@ -32,6 +32,7 @@
 #  include <nuttx/input/buttons.h>
 #endif
 
+#include <assert.h>
 #include <avr/io.h>
 
 #include "avrdx_gpio.h"
@@ -77,13 +78,15 @@
 #ifdef CONFIG_BOARD_EARLY_INITIALIZE
 void board_early_initialize(void)
 {
+#  ifdef CONFIG_BREADXAVR_BUTTONS_DRIVER
   int ret = OK;
+#  endif
 
 #  ifdef CONFIG_BREADXAVR_BUTTONS_DRIVER
   ret = btn_lower_initialize("/dev/buttons");
   if (ret != OK)
     {
-      return;
+      PANIC();
     }
 #  endif
 }

Reply via email to