[PATCH 1/8] mtd: mtdraw: Simplify error path

Sascha Hauer s.hauer at pengutronix.de
Fri Sep 21 04:18:13 PDT 2018


We do not need a printf when writing fails, it's the callers job
to report this. Remove printf and simplify the error path a bit.

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

diff --git a/drivers/mtd/mtdraw.c b/drivers/mtd/mtdraw.c
index 4f7c3b836c..d0dde0dee2 100644
--- a/drivers/mtd/mtdraw.c
+++ b/drivers/mtd/mtdraw.c
@@ -146,11 +146,11 @@ static ssize_t mtdraw_read(struct cdev *cdev, void *buf, size_t count,
 		count -= ret;
 		retlen += ret;
 	}
+
 	if (ret < 0)
-		printf("err %zd\n", ret);
-	else
-		ret = retlen;
-	return ret;
+		return ret;
+
+	return retlen;
 }
 
 #ifdef CONFIG_MTD_WRITE
@@ -231,12 +231,10 @@ static ssize_t mtdraw_write(struct cdev *cdev, const void *buf, size_t count,
 		retlen += count;
 	}
 
-	if (ret < 0) {
-		printf("err %d\n", ret);
+	if (ret < 0)
 		return ret;
-	} else {
-		return retlen;
-	}
+
+	return retlen;
 }
 
 static int mtdraw_erase(struct cdev *cdev, loff_t count, loff_t offset)
-- 
2.19.0




More information about the barebox mailing list