[U-Boot] [PATCH] drivers: net: ldpaa_eth: Correct error handler for qbman_swp_acquire()

Ashish Kumar ashish.kumar at nxp.com
Mon Oct 30 05:23:26 UTC 2017


Hello York,

The definition of qbman_swp_acquire(), is not owned by u-boot, it is part of qbman drivers which is owned by Roy.
u-boot gets this definition from flib code and same is used in u-boot as it is.

So, moving this error handler in qbman_swp_acquire for num == 0, may result in inconsistency in flib code that was provided at the time of integration.

Please suggest.

Regards
Ashish



-----Original Message-----
From: York Sun 
Sent: Thursday, October 26, 2017 8:49 PM
To: Ashish Kumar <ashish.kumar at nxp.com>; u-boot at lists.denx.de
Cc: joe.hershberger at gmail.com; Kushwaha Prabhakar <prabhakar at freescale.com>
Subject: Re: [PATCH] drivers: net: ldpaa_eth: Correct error handler for qbman_swp_acquire()

On 10/26/2017 03:33 AM, Ashish Kumar wrote:
> Correcting error handing for qbman_swp_acquire. The return value is 
> zero is an error condition since number of buffer copied is zero 
> meaning there are no free buffers for allocation.
> 
> Signed-off-by: Ashish Kumar <Ashish.Kumar at nxp.com>
> Signed-off-by: Kushwaha Prabhakar <prabhakar at freescale.com>
> ---
>  drivers/net/ldpaa_eth/ldpaa_eth.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ldpaa_eth/ldpaa_eth.c 
> b/drivers/net/ldpaa_eth/ldpaa_eth.c
> index f235b62..21be79a 100644
> --- a/drivers/net/ldpaa_eth/ldpaa_eth.c
> +++ b/drivers/net/ldpaa_eth/ldpaa_eth.c
> @@ -334,7 +334,7 @@ static int ldpaa_eth_tx(struct eth_device *net_dev, void *buf, int len)
>  					&buffer_start, 1);
>  	} while (err == -EBUSY);
>  
> -	if (err < 0) {
> +	if (err <= 0) {
>  		printf("qbman_swp_acquire() failed\n");
>  		return -ENOMEM;
>  	}
> 

Since you already check for errors in qbman_swp_acquire(), would it be better to check if "num" is zero there?

York


More information about the U-Boot mailing list