[PATCH] tftp: trivial code simplification

Sascha Hauer s.hauer at pengutronix.de
Thu Mar 2 22:15:25 PST 2017


On Thu, Mar 02, 2017 at 05:01:36PM +0100, Uwe Kleine-König wrote:
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig at pengutronix.de>
> ---
>  fs/tftp.c | 10 ++++------
>  1 file changed, 4 insertions(+), 6 deletions(-)

Applied, thanks

Sascha

> 
> 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 at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



More information about the barebox mailing list