mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 1/4] fs: fat: propagate actual error code when opening/creating files
@ 2026-08-25 10:10 Ahmad Fatoum
  2026-08-25 10:10 ` [PATCH 2/4] fs: fat: drop stray printf debug output Ahmad Fatoum
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Ahmad Fatoum @ 2026-08-25 10:10 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

We currently map all error codes to -EINVAL when opening or creating a
file, when the underlying functions are capable of returning more error
codes like -EISDIR or -EROFS.

Propagate the received error code to tell consumers more about what went
wrong.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 fs/fat/fat.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/fs/fat/fat.c b/fs/fat/fat.c
index 0402db1d945a..b17157d1ea34 100644
--- a/fs/fat/fat.c
+++ b/fs/fat/fat.c
@@ -89,7 +89,7 @@ static int fat_create(struct device *dev, const char *pathname, mode_t mode)
 
 	ret = f_open(&priv->fat, &f_file, pathname, FA_OPEN_ALWAYS);
 	if (ret)
-		return -EINVAL;
+		return ret;
 
 	f_close(&f_file);
 
@@ -204,7 +204,7 @@ static int fat_open(struct device *dev, struct file *file, const char *filename)
 	ret = f_open(&priv->fat, f_file, filename, flags);
 	if (ret) {
 		free(f_file);
-		return -EINVAL;
+		return ret;
 	}
 
 	if (file->f_flags & O_APPEND) {
@@ -212,7 +212,7 @@ static int fat_open(struct device *dev, struct file *file, const char *filename)
 		if (ret) {
 			f_close(f_file);
 			free(f_file);
-			return -EINVAL;
+			return ret;
 		}
 	}
 
-- 
2.47.3




^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-08-28 11:54 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-08-25 10:10 [PATCH 1/4] fs: fat: propagate actual error code when opening/creating files Ahmad Fatoum
2026-08-25 10:10 ` [PATCH 2/4] fs: fat: drop stray printf debug output Ahmad Fatoum
2026-08-25 10:10 ` [PATCH 3/4] fs: fat: use fixed-width 32-bit FatFs types Ahmad Fatoum
2026-08-25 10:10 ` [PATCH 4/4] fs: fat: flush metadata updates to the block device Ahmad Fatoum
2026-08-28 11:53 ` [PATCH 1/4] fs: fat: propagate actual error code when opening/creating files Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox