Re: [PATCH net-next 18/29] can: pch_can: do not report txerr and rxerr during bus-off

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Jul 20, 2022 at 10:10:23AM +0200, Marc Kleine-Budde wrote:
> From: Vincent Mailhol <mailhol.vincent@xxxxxxxxxx>
> 
> During bus off, the error count is greater than 255 and can not fit in
> a u8.
> 
> Fixes: 0c78ab76a05c ("pch_can: Add setting TEC/REC statistics processing")
> Link: https://lore.kernel.org/all/20220719143550.3681-2-mailhol.vincent@xxxxxxxxxx
> Signed-off-by: Vincent Mailhol <mailhol.vincent@xxxxxxxxxx>
> Signed-off-by: Marc Kleine-Budde <mkl@xxxxxxxxxxxxxx>
> ---
>  drivers/net/can/pch_can.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/net/can/pch_can.c b/drivers/net/can/pch_can.c
> index fde3ac516d26..497ef77340ea 100644
> --- a/drivers/net/can/pch_can.c
> +++ b/drivers/net/can/pch_can.c
> @@ -496,6 +496,9 @@ static void pch_can_error(struct net_device *ndev, u32 status)
>  		cf->can_id |= CAN_ERR_BUSOFF;
>  		priv->can.can_stats.bus_off++;
>  		can_bus_off(ndev);
> +	} else {
> +		cf->data[6] = errc & PCH_TEC;
> +		cf->data[7] = (errc & PCH_REC) >> 8;
>  	}
>  
>  	errc = ioread32(&priv->regs->errc);
> @@ -556,9 +559,6 @@ static void pch_can_error(struct net_device *ndev, u32 status)
>  		break;
>  	}
>  
> -	cf->data[6] = errc & PCH_TEC;
> -	cf->data[7] = (errc & PCH_REC) >> 8;
> -
>  	priv->can.state = state;
>  	netif_receive_skb(skb);
>  }
> -- 
> 2.35.1
> 
> 
> 

Apologies if this has been reported already, I didn't see anything on
the mailing lists.

This commit is now in -next as commit 3a5c7e4611dd ("can: pch_can: do
not report txerr and rxerr during bus-off"), where it causes the
following clang warning:

  ../drivers/net/can/pch_can.c:501:17: error: variable 'errc' is uninitialized when used here [-Werror,-Wuninitialized]
                  cf->data[6] = errc & PCH_TEC;
                                ^~~~
  ../drivers/net/can/pch_can.c:484:10: note: initialize the variable 'errc' to silence this warning
          u32 errc, lec;
                  ^
                   = 0
  1 error generated.

errc is initialized underneath this now, should it be hoisted or is
there another fix?

Cheers,
Nathan



[Index of Archives]     [Automotive Discussions]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]     [CAN Bus]

  Powered by Linux