From: Michael Grzeschik <m.grzesc...@pengutronix.de> Signed-off-by: Michael Grzeschik <m.grzesc...@pengutronix.de> Signed-off-by: Markus Pargmann <m...@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