[PATCH 5/7] mtd: Fix mtd_op_erase for devices >4GiB

Sascha Hauer s.hauer at pengutronix.de
Tue Feb 9 01:55:46 PST 2016


The mtd erase file operation has a unnecessary conversion to unsigned
long in the offset. Remove it to make it work with chips >4GiB.

Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
 drivers/mtd/core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/mtd/core.c b/drivers/mtd/core.c
index 3251bbc..0bc9fed 100644
--- a/drivers/mtd/core.c
+++ b/drivers/mtd/core.c
@@ -148,7 +148,7 @@ static int mtd_op_erase(struct cdev *cdev, size_t count, loff_t offset)
 {
 	struct mtd_info *mtd = cdev->priv;
 	struct erase_info erase;
-	uint32_t addr;
+	loff_t addr;
 	int ret;
 
 	ret = mtd_erase_align(mtd, &count, &offset);
@@ -178,7 +178,7 @@ static int mtd_op_erase(struct cdev *cdev, size_t count, loff_t offset)
 		erase.addr = addr;
 
 		if (ret > 0) {
-			printf("Skipping bad block at 0x%08x\n", addr);
+			printf("Skipping bad block at 0x%08llx\n", addr);
 		} else {
 			ret = mtd_erase(mtd, &erase);
 			if (ret)
-- 
2.7.0.rc3




More information about the barebox mailing list