netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Nathan Chancellor <nathan@kernel.org>
To: Marc Kleine-Budde <mkl@pengutronix.de>
Cc: netdev@vger.kernel.org, davem@davemloft.net, kuba@kernel.org,
	linux-can@vger.kernel.org, kernel@pengutronix.de,
	Vincent Mailhol <mailhol.vincent@wanadoo.fr>,
	llvm@lists.linux.dev
Subject: Re: [PATCH net-next 18/29] can: pch_can: do not report txerr and rxerr during bus-off
Date: Thu, 21 Jul 2022 08:27:06 -0700	[thread overview]
Message-ID: <YtlwSpoeT+nhmhVn@dev-arch.thelio-3990X> (raw)
In-Reply-To: <20220720081034.3277385-19-mkl@pengutronix.de>

On Wed, Jul 20, 2022 at 10:10:23AM +0200, Marc Kleine-Budde wrote:
> From: Vincent Mailhol <mailhol.vincent@wanadoo.fr>
> 
> 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@wanadoo.fr
> Signed-off-by: Vincent Mailhol <mailhol.vincent@wanadoo.fr>
> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
> ---
>  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

  reply	other threads:[~2022-07-21 15:27 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-20  8:10 [PATCH net-next 0/29] pull-request: can-next 2022-07-20 Marc Kleine-Budde
2022-07-20  8:10 ` [PATCH net-next 01/29] can: slcan: use scnprintf() as a hardening measure Marc Kleine-Budde
2022-07-20  9:30   ` patchwork-bot+netdevbpf
2022-07-20  8:10 ` [PATCH net-next 02/29] can: slcan: convert comments to network style comments Marc Kleine-Budde
2022-07-20  8:10 ` [PATCH net-next 03/29] can: slcan: slcan_init() convert printk(LEVEL ...) to pr_level() Marc Kleine-Budde
2022-07-20  8:10 ` [PATCH net-next 04/29] can: slcan: fix whitespace issues Marc Kleine-Budde
2022-07-20  8:10 ` [PATCH net-next 05/29] can: slcan: convert comparison to NULL into !val Marc Kleine-Budde
2022-07-20  8:10 ` [PATCH net-next 06/29] can: slcan: clean up if/else Marc Kleine-Budde
2022-07-20  8:10 ` [PATCH net-next 07/29] dt-bindings: can: sja1000: Convert to json-schema Marc Kleine-Budde
2022-07-20  8:10 ` [PATCH net-next 08/29] dt-bindings: can: nxp,sja1000: Document RZ/N1{D,S} support Marc Kleine-Budde
2022-07-20  8:10 ` [PATCH net-next 09/29] can: sja1000: Add Quirk for RZ/N1 SJA1000 CAN controller Marc Kleine-Budde
2022-07-20  8:10 ` [PATCH net-next 10/29] can: sja1000: Use device_get_match_data to get device data Marc Kleine-Budde
2022-07-20  8:10 ` [PATCH net-next 11/29] can: sja1000: Change the return type as void for SoC specific init Marc Kleine-Budde
2022-07-20  8:10 ` [PATCH net-next 12/29] can: slcan: do not sleep with a spin lock held Marc Kleine-Budde
2022-07-20  8:10 ` [PATCH net-next 13/29] can: c_can: remove wrong comment Marc Kleine-Budde
2022-07-20  8:10 ` [PATCH net-next 14/29] can: ctucanfd: Update CTU CAN FD IP core registers to match version 3.x Marc Kleine-Budde
2022-07-20  8:10 ` [PATCH net-next 15/29] can: peak_usb: pcan_dump_mem(): mark input prompt and data pointer as const Marc Kleine-Budde
2022-07-20  8:10 ` [PATCH net-next 16/29] can: peak_usb: correction of an initially misnamed field name Marc Kleine-Budde
2022-07-20  8:10 ` [PATCH net-next 17/29] can: peak_usb: include support for a new MCU Marc Kleine-Budde
2022-07-20  8:10 ` [PATCH net-next 18/29] can: pch_can: do not report txerr and rxerr during bus-off Marc Kleine-Budde
2022-07-21 15:27   ` Nathan Chancellor [this message]
2022-07-21 15:47     ` Marc Kleine-Budde
2022-07-21 16:11       ` Vincent MAILHOL
2022-07-21 16:20         ` Nathan Chancellor
2022-07-21 16:51           ` Jakub Kicinski
2022-07-21 16:00     ` [PATCH] can: pch_can: initialize errc before using it Vincent Mailhol
2022-07-21 16:02       ` Nathan Chancellor
2022-07-20  8:10 ` [PATCH net-next 19/29] can: rcar_can: do not report txerr and rxerr during bus-off Marc Kleine-Budde
2022-07-20  8:10 ` [PATCH net-next 20/29] can: sja1000: " Marc Kleine-Budde
2022-07-20  8:10 ` [PATCH net-next 21/29] can: slcan: " Marc Kleine-Budde
2022-07-20  8:10 ` [PATCH net-next 22/29] can: hi311x: " Marc Kleine-Budde
2022-07-20  8:10 ` [PATCH net-next 23/29] can: sun4i_can: " Marc Kleine-Budde
2022-07-20  8:10 ` [PATCH net-next 24/29] can: kvaser_usb_hydra: " Marc Kleine-Budde
2022-07-20  8:10 ` [PATCH net-next 25/29] can: kvaser_usb_leaf: " Marc Kleine-Budde
2022-07-20  8:10 ` [PATCH net-next 26/29] can: usb_8dev: " Marc Kleine-Budde
2022-07-20  8:10 ` [PATCH net-next 27/29] can: error: specify the values of data[5..7] of CAN error frames Marc Kleine-Budde
2022-07-20  8:10 ` [PATCH net-next 28/29] can: add CAN_ERR_CNT flag to notify availability of error counter Marc Kleine-Budde
2022-07-20  8:10 ` [PATCH net-next 29/29] can: error: add definitions for the different CAN error thresholds Marc Kleine-Budde

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YtlwSpoeT+nhmhVn@dev-arch.thelio-3990X \
    --to=nathan@kernel.org \
    --cc=davem@davemloft.net \
    --cc=kernel@pengutronix.de \
    --cc=kuba@kernel.org \
    --cc=linux-can@vger.kernel.org \
    --cc=llvm@lists.linux.dev \
    --cc=mailhol.vincent@wanadoo.fr \
    --cc=mkl@pengutronix.de \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).