On 21.07.2022 08:27:06, Nathan Chancellor wrote: > 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? Doh! I'll send a fix. regards, Marc -- Pengutronix e.K. | Marc Kleine-Budde | Embedded Linux | https://www.pengutronix.de | Vertretung West/Dortmund | Phone: +49-231-2826-924 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
Attachment:
signature.asc
Description: PGP signature