This patch allows into the DFU backend to indicate that there is no
remaining data (for EOF for example). That allows users to read a
buffer greater than the device size; the dfu stack stops the read
request when the backend return a length=0 without error.

Signed-off-by: Patrick Delaunay <patrick.delau...@st.com>
---

 drivers/dfu/dfu.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/dfu/dfu.c b/drivers/dfu/dfu.c
index 8bd5216017..50919fcae9 100644
--- a/drivers/dfu/dfu.c
+++ b/drivers/dfu/dfu.c
@@ -396,6 +396,8 @@ static int dfu_read_buffer_fill(struct dfu_entity *dfu, 
void *buf, int size)
                                debug("%s: Read error!\n", __func__);
                                return ret;
                        }
+                       if (dfu->b_left == 0)
+                               break;
                        dfu->offset += dfu->b_left;
                        dfu->r_left -= dfu->b_left;
 
-- 
2.17.1

_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot

Reply via email to