On Fri. 22 Jul. 2022 at 00:49, Marc Kleine-Budde <mkl@xxxxxxxxxxxxxx> wrote: > 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? Thanks for reporting and sorry for the bug. That said, I have one complaint: this type of warning is reported at W=2 *but* W=2 output is heavily polluted, mostly due to a false positive on linux/bits.h's GENMASK_INPUT_CHECK(). Under the current situation, the relevant warings become invisible with all the flooding. I tried to send a patch to silence a huge chunk of the W=2 spam in [1] but it got rejected. I am sorry but even with the best intent, I might repeat a similar mistake in the future. The W=2 is just not usable. [1] https://lore.kernel.org/all/20220426161658.437466-1-mailhol.vincent@xxxxxxxxxx/ > Doh! I'll send a fix. Thanks Marc for the patch!