From: Markus Pargmann <mpa@pengutronix.de>
To: barebox@lists.infradead.org
Cc: mgr@pengutronix.de
Subject: [PATCH v2 6/6] barebox-state: handle flush errno correctly
Date: Fri, 24 Jun 2016 12:06:02 +0200 [thread overview]
Message-ID: <1466762762-15212-7-git-send-email-mpa@pengutronix.de> (raw)
In-Reply-To: <1466762762-15212-1-git-send-email-mpa@pengutronix.de>
From: Michael Grzeschik <m.grzeschik@pengutronix.de>
Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
---
common/state/backend_bucket_circular.c | 13 ++++++++++---
common/state/backend_bucket_direct.c | 11 +++++++++--
2 files changed, 19 insertions(+), 5 deletions(-)
diff --git a/common/state/backend_bucket_circular.c b/common/state/backend_bucket_circular.c
index 64e9be2e9979..3e48733ba269 100644
--- a/common/state/backend_bucket_circular.c
+++ b/common/state/backend_bucket_circular.c
@@ -216,10 +216,17 @@ static int state_mtd_peb_write(struct state_backend_storage_bucket_circular *cir
}
/*
- * We keep the fd open, so flush is necessary. We ignore the return
- * value as flush is currently not supported for mtd under linux.
+ * We keep the fd open, so flush is necessary. We ignore the
+ * errno EINVAL as flush is currently not supported for
+ * mtd under linux.
*/
- flush(circ->fd);
+ ret = flush(circ->fd);
+ if (ret < 0) {
+ if (errno != EINVAL) {
+ dev_err(direct->dev, "Failed to flush file, %d\n", -errno);
+ return ret;
+ }
+ }
dev_dbg(circ->dev, "Written state to offset %ld length %zd data length %zd\n",
offset, len, len);
diff --git a/common/state/backend_bucket_direct.c b/common/state/backend_bucket_direct.c
index 772267f6dc1d..1f7fb1c8c2e4 100644
--- a/common/state/backend_bucket_direct.c
+++ b/common/state/backend_bucket_direct.c
@@ -183,10 +183,17 @@ static int state_backend_bucket_direct_write(struct state_backend_storage_bucket
return ret;
}
+ /*
+ * We keep the fd open, so flush is necessary. We ignore the
+ * errno EINVAL as flush is currently not supported for
+ * mtd under linux.
+ */
ret = flush(direct->fd);
if (ret < 0) {
- dev_err(direct->dev, "Failed to flush file, %d\n", ret);
- return ret;
+ if (errno != EINVAL) {
+ dev_err(direct->dev, "Failed to flush file, %d\n", -errno);
+ return ret;
+ }
}
return 0;
--
2.8.1
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
prev parent reply other threads:[~2016-06-24 10:07 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-24 10:05 [PATCH v2 0/6] state: Refactor backend Markus Pargmann
2016-06-24 10:05 ` [PATCH v2 1/6] libfile: Change write_full to be have const buf Markus Pargmann
2016-06-24 10:05 ` [PATCH v2 2/6] state: Refactor state framework Markus Pargmann
2016-06-24 10:05 ` [PATCH v2 3/6] docs: Add/Update state documentation Markus Pargmann
2016-06-24 10:06 ` [PATCH v2 4/6] state: also append backend storage stridesize Markus Pargmann
2016-06-24 10:06 ` [PATCH v2 5/6] state: backend_storage_direct: also use cached data on write Markus Pargmann
2016-06-28 6:18 ` Sascha Hauer
2016-06-28 6:55 ` Michael Grzeschik
2016-06-29 5:56 ` Markus Pargmann
2016-06-24 10:06 ` Markus Pargmann [this message]
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=1466762762-15212-7-git-send-email-mpa@pengutronix.de \
--to=mpa@pengutronix.de \
--cc=barebox@lists.infradead.org \
--cc=mgr@pengutronix.de \
/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