[PATCH] tftp: trivial code simplification

Uwe Kleine-König u.kleine-koenig at pengutronix.de
Thu Mar 2 08:01:36 PST 2017


Signed-off-by: Uwe Kleine-König <u.kleine-koenig at pengutronix.de>
---
 fs/tftp.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/fs/tftp.c b/fs/tftp.c
index 272a7106eb51..bc3580289286 100644
--- a/fs/tftp.c
+++ b/fs/tftp.c
@@ -568,13 +568,11 @@ static int tftp_read(struct device_d *dev, FILE *f, void *buf, size_t insize)
 
 	while (insize) {
 		now = kfifo_get(priv->fifo, buf, insize);
+		outsize += now;
+		buf += now;
+		insize -= now;
 		if (priv->state == STATE_DONE)
-			return outsize + now;
-		if (now) {
-			outsize += now;
-			buf += now;
-			insize -= now;
-		}
+			return outsize;
 
 		if (TFTP_FIFO_SIZE - kfifo_len(priv->fifo) >= priv->blocksize)
 			tftp_send(priv);
-- 
2.11.0




More information about the barebox mailing list