On Tue, Apr 04, 2017 at 06:54:25PM +0100, Joao Pinto wrote:
[...]
> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c 
> b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
[...]
>  static void stmmac_display_rx_rings(struct stmmac_priv *priv)
>  {
> +     u32 rx_cnt = priv->plat->rx_queues_to_use;
>       void *head_rx;
> +     u32 queue;
>  
> -     if (priv->extend_desc)
> -             head_rx = (void *)priv->dma_erx;
> -     else
> -             head_rx = (void *)priv->dma_rx;
> +     /* Display RX rings */
> +     for (queue = 0; queue < rx_cnt; queue++) {
> +             struct stmmac_rx_queue *rx_q = &priv->rx_queue[queue];
>  
> -     /* Display RX ring */
> -     priv->hw->desc->display_ring(head_rx, DMA_RX_SIZE, true);
> +             pr_info("\tRX Queue %d rings\n", queue);

Nit: %u is the right specifier for unsigned integers.

> @@ -1107,46 +1135,65 @@ static int init_dma_rx_desc_rings(struct net_device 
> *dev, gfp_t flags)
[...]
>  err_init_rx_buffers:
> -     while (--i >= 0)
> -             stmmac_free_rx_buffers(priv, i);
> +     while (queue-- >= 0) {

Why are you switching to postfix decrement here? Not only is it
inconsistent with the prefix decrement below, I think this also gives
you a wrong result. Consider what happens if queue == 0. The condition
evaluates to true, but within the loop the queue variable will wrap to
~0 and probably crash stmmac_free_rx_buffers().

Other than that, this looks fine, so with the above fixed:

Reviewed-by: Thierry Reding <tred...@nvidia.com>

Also works on Tegra186, so:

Tested-by: Thierry Reding <tred...@nvidia.com>

Attachment: signature.asc
Description: PGP signature

Reply via email to