From 3ec7a9375f7d38ab3c892bd284866800a0803d1f Mon Sep 17 00:00:00 2001 From: Marco Casaroli Date: Sat, 1 Aug 2026 20:30:50 +0200 Subject: [PATCH] boards/arm/rp23xx: Do not log an absent SD card as an error. board_spisd_initialize() logged "ERROR: Failed to mount the SDCARD" at every boot when the mount failed. The two usual causes are no card in the slot and a card with no filesystem. Neither is an error: the block device is registered, and the card can be formatted with mkfatfs and mounted later. Log -EINVAL and -ENODEV from nx_mount() with finfo(). Other errors are still logged with ferr(), as the rest of the file does. Also include errno.h, which the file used without including it. Assisted-by: Claude Code:claude-opus-5-5 Signed-off-by: Marco Casaroli --- boards/arm/rp23xx/common/src/rp23xx_spisd.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/boards/arm/rp23xx/common/src/rp23xx_spisd.c b/boards/arm/rp23xx/common/src/rp23xx_spisd.c index 211ce5e2243..7706eb50399 100644 --- a/boards/arm/rp23xx/common/src/rp23xx_spisd.c +++ b/boards/arm/rp23xx/common/src/rp23xx_spisd.c @@ -24,6 +24,8 @@ #include +#include + #include #include #include @@ -99,9 +101,17 @@ int board_spisd_initialize(int minor, int bus) /* Mount filesystem */ ret = nx_mount("/dev/mmcsd0", "/mnt/sd0", "vfat", 0, NULL); - if (ret < 0) + if (ret == -EINVAL || ret == -ENODEV) { - _err("ERROR: Failed to mount the SDCARD. %d\n", ret); + /* No card, or no filesystem on it. Not an error: the block device + * is registered and the card can be formatted with mkfatfs. + */ + + finfo("No filesystem on /dev/mmcsd0 (no card, or unformatted)\n"); + } + else if (ret < 0) + { + ferr("ERROR: Failed to mount the SDCARD. %d\n", ret); } return OK;