mirror of
https://github.com/apache/nuttx.git
synced 2026-10-10 07:40:27 +00:00
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 <marco.casaroli@gmail.com>
This commit is contained in:
parent
5b597668f0
commit
3ec7a9375f
1 changed files with 12 additions and 2 deletions
|
|
@ -24,6 +24,8 @@
|
|||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <errno.h>
|
||||
|
||||
#include <nuttx/debug.h>
|
||||
#include <nuttx/mmcsd.h>
|
||||
#include <nuttx/board.h>
|
||||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue