[PATCH 4/7] fs: exfat: Fix exfat_fs_exists() return value

Marek Vasut marex at denx.de
Sun Apr 13 10:55:02 CEST 2025


The exfat_fs_exists() should return 0 in case the path does not exist,
and 1 in case the path does exist. Fix the inverted return value. This
fixes 'test -e' command with exfat.

Fixes: b86a651b646c ("fs: exfat: Add U-Boot porting layer")
Signed-off-by: Marek Vasut <marex at denx.de>
---
Cc: Heinrich Schuchardt <xypron.glpk at gmx.de>
Cc: Ilias Apalodimas <ilias.apalodimas at linaro.org>
Cc: Mattijs Korpershoek <mkorpershoek at baylibre.com>
Cc: Simon Glass <sjg at chromium.org>
Cc: Tom Rini <trini at konsulko.com>
Cc: u-boot at lists.denx.de
---
 fs/exfat/io.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/exfat/io.c b/fs/exfat/io.c
index 004ba5d3e45..43c05713ed0 100644
--- a/fs/exfat/io.c
+++ b/fs/exfat/io.c
@@ -875,11 +875,11 @@ int exfat_fs_exists(const char *filename)
 
 	err = exfat_lookup_realpath(&ctxt.ef, &node, filename);
 	if (err)
-		return err;
+		return 0;
 
 	exfat_put_node(&ctxt.ef, node);
 
-	return 0;
+	return 1;
 }
 
 int exfat_fs_size(const char *filename, loff_t *size)
-- 
2.47.2



More information about the U-Boot mailing list