diff --git a/drivers/mmcsd/mmcsd_spi.c b/drivers/mmcsd/mmcsd_spi.c index fe7e3551734..444ba024b8f 100644 --- a/drivers/mmcsd/mmcsd_spi.c +++ b/drivers/mmcsd/mmcsd_spi.c @@ -54,6 +54,7 @@ #include #include +#include #include #include #include @@ -445,8 +446,9 @@ static int mmcsd_waitready(FAR struct mmcsd_slot_s *slot) if (elapsed > MMCSD_DELAY_10MS) { - // Give other threads time to run - usleep(10000); + /* Give other threads time to run */ + + nxsig_usleep(10000); } } while (elapsed < MMCSD_DELAY_500MS); diff --git a/fs/fat/fs_fat32dirent.c b/fs/fat/fs_fat32dirent.c index 5d678f0da55..2be3ce261f0 100644 --- a/fs/fat/fs_fat32dirent.c +++ b/fs/fat/fs_fat32dirent.c @@ -758,7 +758,9 @@ static inline int fat_createalias(struct fat_dirinfo_s *dirinfo) #if defined(CONFIG_FAT_LFN_ALIAS_TRAILCHARS) && CONFIG_FAT_LFN_ALIAS_TRAILCHARS > 0 /* Take first 6-N characters from beginning of filename and last N * characters from end of the filename. Useful for filenames like - * "datafile123.txt". */ + * "datafile123.txt". + */ + if (ndx == 6 - CONFIG_FAT_LFN_ALIAS_TRAILCHARS && namechars > CONFIG_FAT_LFN_ALIAS_TRAILCHARS) { @@ -849,10 +851,14 @@ static inline int fat_uniquealias(struct fat_mountpt_s *fs, DEBUGASSERT(dirinfo->fd_name[lsdigit] == '1'); #ifdef CONFIG_FAT_LFN_ALIAS_HASH - /* Add a hash of the long filename to the short filename, to reduce collisions. */ + /* Add a hash of the long filename to the short filename, to reduce + * collisions. + */ + if ((ret = fat_findalias(fs, dirinfo)) == OK) { uint16_t hash = dirinfo->fd_seq.ds_offset; + for (i = 0; dirinfo->fd_lfname[i] != '\0'; i++) { hash = ((hash << 5) + hash) ^ dirinfo->fd_lfname[i];