[PATCH 4/9] usb: gadget: fastboot: use read_file_2

Sascha Hauer s.hauer at pengutronix.de
Fri Feb 9 01:43:11 PST 2018


read_file_2 gives us a proper error code and allows us
to specify a maximum size which in this case we happen to know.

Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
 drivers/usb/gadget/f_fastboot.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/gadget/f_fastboot.c b/drivers/usb/gadget/f_fastboot.c
index 81522cbba6..62b13bcb8c 100644
--- a/drivers/usb/gadget/f_fastboot.c
+++ b/drivers/usb/gadget/f_fastboot.c
@@ -947,8 +947,9 @@ static void cb_flash(struct f_fastboot *f_fb, const char *cmd)
 
 		fastboot_tx_print(f_fb, "INFOThis is a barebox image...");
 
-		image = read_file(data.imagefile, &data.len);
-		if (!image) {
+		ret = read_file_2(data.imagefile, &data.len, &image,
+				  f_fb->download_size);
+		if (ret) {
 			fastboot_tx_print(f_fb, "FAILreading barebox");
 			return;
 		}
-- 
2.15.1




More information about the barebox mailing list