diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2015-08-31 13:15:03 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2015-11-23 10:36:13 +0100 |
commit | 770c1ef83c2628cea4e9070810609b102037339a (patch) | |
tree | a24e8c8b3b3729321f36736249614289be0e7359 | |
parent | b9170a1bde192c691f15c4474ed2f1e7bfebbb41 (diff) | |
download | barebox-770c1ef83c2628cea4e9070810609b102037339a.tar.gz barebox-770c1ef83c2628cea4e9070810609b102037339a.tar.xz |
mtd: core: initialize *retlen in mtd_write()
Some mtd drivers like the spi-nor driver do not assign a value
to the retlen pointer but instead only add the bytes written
to *retlen. Users of mtd_write expect the variable to be initialized
by the mtd core though, so we have to do it in mtd_write(). The
same is done in mtd_read already.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r-- | drivers/mtd/core.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/mtd/core.c b/drivers/mtd/core.c index d873369d5d..62307db709 100644 --- a/drivers/mtd/core.c +++ b/drivers/mtd/core.c @@ -340,6 +340,8 @@ int mtd_read(struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, int mtd_write(struct mtd_info *mtd, loff_t to, size_t len, size_t *retlen, const u_char *buf) { + *retlen = 0; + return mtd->write(mtd, to, len, retlen, buf); } |