9
0
Fork 0

tftp: trivial code simplification

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This commit is contained in:
Uwe Kleine-König 2017-03-02 17:01:36 +01:00 committed by Sascha Hauer
parent 2eacc573df
commit 74f750fe65
1 changed files with 4 additions and 6 deletions

View File

@ -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);