aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/mtdconcat.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/mtd/mtdconcat.c')
-rw-r--r--drivers/mtd/mtdconcat.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/drivers/mtd/mtdconcat.c b/drivers/mtd/mtdconcat.c
index 38151b8e6631..3c8d5e6fa010 100644
--- a/drivers/mtd/mtdconcat.c
+++ b/drivers/mtd/mtdconcat.c
@@ -56,7 +56,7 @@ concat_read(struct mtd_info *mtd, loff_t from, size_t len,
56 size_t * retlen, u_char * buf) 56 size_t * retlen, u_char * buf)
57{ 57{
58 struct mtd_concat *concat = CONCAT(mtd); 58 struct mtd_concat *concat = CONCAT(mtd);
59 int err = -EINVAL; 59 int ret = 0, err = -EINVAL;
60 int i; 60 int i;
61 61
62 *retlen = 0; 62 *retlen = 0;
@@ -80,9 +80,18 @@ concat_read(struct mtd_info *mtd, loff_t from, size_t len,
80 80
81 err = subdev->read(subdev, from, size, &retsize, buf); 81 err = subdev->read(subdev, from, size, &retsize, buf);
82 82
83 if (err) 83 if (err && (err != -EBADMSG) && (err != -EUCLEAN))
84 break; 84 break;
85 85
86 /* Save information about bitflips! */
87 if (err) {
88 if (err == -EBADMSG)
89 ret = err;
90 else if (!ret)
91 ret = err;
92 err = 0;
93 }
94
86 *retlen += retsize; 95 *retlen += retsize;
87 len -= size; 96 len -= size;
88 if (len == 0) 97 if (len == 0)
@@ -92,7 +101,7 @@ concat_read(struct mtd_info *mtd, loff_t from, size_t len,
92 buf += size; 101 buf += size;
93 from = 0; 102 from = 0;
94 } 103 }
95 return err; 104 return err ? err : ret;
96} 105}
97 106
98static int 107static int