summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorUlrich Ölmann <u.oelmann@pengutronix.de>2016-11-22 16:21:21 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2017-01-10 08:27:33 +0100
commit520ac28b41c7350194451e8f6a6c7dc1bece07f8 (patch)
tree8897aa4976069e3937ae9a872815b0c003e85c04 /drivers
parent6dc7dae989aa9957f8c20474c66fd0d02da1bdd6 (diff)
downloadbarebox-520ac28b41c7350194451e8f6a6c7dc1bece07f8.tar.gz
barebox-520ac28b41c7350194451e8f6a6c7dc1bece07f8.tar.xz
ubi: Only read necessary size when reading the VID header
Based on kernel commit 8a8e8d2fdbab ("ubi: Only read necessary size when reading the VID header") by Sascha Hauer <s.hauer@pengutronix.de>: When reading the vid hdr from the device UBI always reads a whole page. Instead, read only the data we actually need and speed up attachment of UBI devices by potentially making use of reading subpages if the NAND driver supports it. Since the VID header may be at offset vid_hdr_shift in the page and we can only read from the beginning of a page we have to add that offset to the read size. Signed-off-by: Ulrich Ölmann <u.oelmann@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/mtd/ubi/io.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/mtd/ubi/io.c b/drivers/mtd/ubi/io.c
index 43af4a52df..6d08f92ea6 100644
--- a/drivers/mtd/ubi/io.c
+++ b/drivers/mtd/ubi/io.c
@@ -711,7 +711,7 @@ int ubi_io_read_vid_hdr(struct ubi_device *ubi, int pnum,
p = (char *)vid_hdr - ubi->vid_hdr_shift;
read_err = ubi_io_read(ubi, p, pnum, ubi->vid_hdr_aloffset,
- ubi->vid_hdr_alsize);
+ ubi->vid_hdr_shift + UBI_VID_HDR_SIZE);
if (read_err && read_err != UBI_IO_BITFLIPS && !mtd_is_eccerr(read_err))
return read_err;