From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH 1/4] fs: fat: propagate actual error code when opening/creating files
Date: Tue, 25 Aug 2026 12:10:53 +0200 [thread overview]
Message-ID: <20260825101106.2127202-1-a.fatoum@pengutronix.de> (raw)
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
next reply other threads:[~2026-08-25 10:32 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-25 10:10 Ahmad Fatoum [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260825101106.2127202-1-a.fatoum@pengutronix.de \
--to=a.fatoum@pengutronix.de \
--cc=barebox@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox