mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] tftp: trivial code simplification
@ 2017-03-02 16:01 Uwe Kleine-König
  2017-03-03  6:15 ` Sascha Hauer
  0 siblings, 1 reply; 2+ messages in thread
From: Uwe Kleine-König @ 2017-03-02 16:01 UTC (permalink / raw)
  To: barebox

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@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


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-03-03  6:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-02 16:01 [PATCH] tftp: trivial code simplification Uwe Kleine-König
2017-03-03  6:15 ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox