netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] can: pch_can: move setting of errc to before use
@ 2022-07-21 16:15 Tom Rix
  2022-07-21 16:21 ` Vincent MAILHOL
  0 siblings, 1 reply; 2+ messages in thread
From: Tom Rix @ 2022-07-21 16:15 UTC (permalink / raw)
  To: wg, mkl, davem, edumazet, kuba, pabeni, nathan, ndesaulniers,
	mailhol.vincent
  Cc: linux-can, netdev, linux-kernel, llvm, Tom Rix

clang build fails with
drivers/net/can/pch_can.c:501:17: error: variable 'errc' is uninitialized when used here [-Werror,-Wuninitialized]
                cf->data[6] = errc & PCH_TEC;

The commit in the fixes moved the use without moving the setting. So move
the setting of errc to before the use.

Fixes: 3a5c7e4611dd ("can: pch_can: do not report txerr and rxerr during bus-off")
Signed-off-by: Tom Rix <trix@redhat.com>
---
 drivers/net/can/pch_can.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/can/pch_can.c b/drivers/net/can/pch_can.c
index 50f6719b3aa4..32804fed116c 100644
--- a/drivers/net/can/pch_can.c
+++ b/drivers/net/can/pch_can.c
@@ -489,6 +489,7 @@ static void pch_can_error(struct net_device *ndev, u32 status)
 	if (!skb)
 		return;
 
+	errc = ioread32(&priv->regs->errc);
 	if (status & PCH_BUS_OFF) {
 		pch_can_set_tx_all(priv, 0);
 		pch_can_set_rx_all(priv, 0);
@@ -502,7 +503,6 @@ static void pch_can_error(struct net_device *ndev, u32 status)
 		cf->data[7] = (errc & PCH_REC) >> 8;
 	}
 
-	errc = ioread32(&priv->regs->errc);
 	/* Warning interrupt. */
 	if (status & PCH_EWARN) {
 		state = CAN_STATE_ERROR_WARNING;
-- 
2.27.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] can: pch_can: move setting of errc to before use
  2022-07-21 16:15 [PATCH] can: pch_can: move setting of errc to before use Tom Rix
@ 2022-07-21 16:21 ` Vincent MAILHOL
  0 siblings, 0 replies; 2+ messages in thread
From: Vincent MAILHOL @ 2022-07-21 16:21 UTC (permalink / raw)
  To: Tom Rix
  Cc: wg, mkl, davem, edumazet, kuba, pabeni, nathan, ndesaulniers,
	linux-can, netdev, linux-kernel, llvm

On Fri. 22 juil. 2022 à 01:18, Tom Rix <trix@redhat.com> wrote:
> clang build fails with
> drivers/net/can/pch_can.c:501:17: error: variable 'errc' is uninitialized when used here [-Werror,-Wuninitialized]
>                 cf->data[6] = errc & PCH_TEC;
>
> The commit in the fixes moved the use without moving the setting. So move
> the setting of errc to before the use.
>
> Fixes: 3a5c7e4611dd ("can: pch_can: do not report txerr and rxerr during bus-off")
> Signed-off-by: Tom Rix <trix@redhat.com>

Sorry, you are a couple minutes late. You are actually the third to
submit the same patch:
https://lore.kernel.org/linux-can/20220721155228.3399103-1-mkl@pengutronix.de/
https://lore.kernel.org/linux-can/20220721160032.9348-1-mailhol.vincent@wanadoo.fr/

But thanks for this!


Yours sincerely,
Vincent Mailhol

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-07-21 16:22 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-21 16:15 [PATCH] can: pch_can: move setting of errc to before use Tom Rix
2022-07-21 16:21 ` Vincent MAILHOL

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).