mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH master 3/3] pstore: return -ENOENT when file is missing
Date: Mon,  6 May 2024 18:02:46 +0200	[thread overview]
Message-ID: <20240506160246.2198975-3-a.fatoum@pengutronix.de> (raw)
In-Reply-To: <20240506160246.2198975-1-a.fatoum@pengutronix.de>

The expectation with stat(2) and open(2) is that they report -ENOENT if
a file name doesn't exist. Return this instead of the unexpected -EINVAL
error code.

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

diff --git a/fs/pstore/fs.c b/fs/pstore/fs.c
index 777e2448cc62..238a316e9157 100644
--- a/fs/pstore/fs.c
+++ b/fs/pstore/fs.c
@@ -148,7 +148,7 @@ static int pstore_open(struct device *dev, FILE *file, const char *filename)
 
 	d = pstore_get_by_name(head, filename);
 	if (!d)
-		return -EINVAL;
+		return -ENOENT;
 
 	file->size = d->size;
 	file->priv = d;
@@ -226,7 +226,7 @@ static int pstore_stat(struct device *dev, const char *filename,
 
 	d = pstore_get_by_name(&allpstore, filename);
 	if (!d)
-		return -EINVAL;
+		return -ENOENT;
 
 	s->st_size = d->size;
 	s->st_mode = S_IFREG | S_IRWXU | S_IRWXG | S_IRWXO;
-- 
2.39.2




  parent reply	other threads:[~2024-05-06 16:06 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-06 16:02 [PATCH master 1/3] pstore: ramoops: fix use of wrong types on 64-bit Ahmad Fatoum
2024-05-06 16:02 ` [PATCH master 2/3] pstore: fix size of OF fixup memory region Ahmad Fatoum
2024-05-06 16:02 ` Ahmad Fatoum [this message]
2024-05-07  7:33 ` [PATCH master 1/3] pstore: ramoops: fix use of wrong types on 64-bit 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=20240506160246.2198975-3-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