All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] can: pch_can: fix uninitialized use of errc
@ 2022-07-21 15:52 Marc Kleine-Budde
  2022-07-21 15:56 ` Nathan Chancellor
  2022-07-21 16:03 ` Vincent MAILHOL
  0 siblings, 2 replies; 3+ messages in thread
From: Marc Kleine-Budde @ 2022-07-21 15:52 UTC (permalink / raw)
  To: linux-can; +Cc: Marc Kleine-Budde, Nathan Chancellor, Vincent Mailhol

Fix the uninitialized use of errc by moving the ioread32() up, before
accessing it.

Fixes: 3a5c7e4611dd ("can: pch_can: do not report txerr and rxerr during bus-off")
Reported-by: Nathan Chancellor <nathan@kernel.org>
Cc: Vincent Mailhol <mailhol.vincent@wanadoo.fr>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
 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.35.1



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

* Re: [PATCH] can: pch_can: fix uninitialized use of errc
  2022-07-21 15:52 [PATCH] can: pch_can: fix uninitialized use of errc Marc Kleine-Budde
@ 2022-07-21 15:56 ` Nathan Chancellor
  2022-07-21 16:03 ` Vincent MAILHOL
  1 sibling, 0 replies; 3+ messages in thread
From: Nathan Chancellor @ 2022-07-21 15:56 UTC (permalink / raw)
  To: Marc Kleine-Budde; +Cc: linux-can, Vincent Mailhol

On Thu, Jul 21, 2022 at 05:52:28PM +0200, Marc Kleine-Budde wrote:
> Fix the uninitialized use of errc by moving the ioread32() up, before
> accessing it.
> 
> Fixes: 3a5c7e4611dd ("can: pch_can: do not report txerr and rxerr during bus-off")
> Reported-by: Nathan Chancellor <nathan@kernel.org>
> Cc: Vincent Mailhol <mailhol.vincent@wanadoo.fr>
> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>

Reviewed-by: Nathan Chancellor <nathan@kernel.org>

Thanks a lot for the quick fix!

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

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

* Re: [PATCH] can: pch_can: fix uninitialized use of errc
  2022-07-21 15:52 [PATCH] can: pch_can: fix uninitialized use of errc Marc Kleine-Budde
  2022-07-21 15:56 ` Nathan Chancellor
@ 2022-07-21 16:03 ` Vincent MAILHOL
  1 sibling, 0 replies; 3+ messages in thread
From: Vincent MAILHOL @ 2022-07-21 16:03 UTC (permalink / raw)
  To: Marc Kleine-Budde; +Cc: linux-can, Nathan Chancellor

On Fri. 22 Jul. 2022 at 00:54, Marc Kleine-Budde <mkl@pengutronix.de> wrote:
> Fix the uninitialized use of errc by moving the ioread32() up, before
> accessing it.
>
> Fixes: 3a5c7e4611dd ("can: pch_can: do not report txerr and rxerr during bus-off")
> Reported-by: Nathan Chancellor <nathan@kernel.org>
> Cc: Vincent Mailhol <mailhol.vincent@wanadoo.fr>
> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>

I did not see that you were working on it. I also sent a patch but you
beat me by six minutes. Thanks for the quick action!

Acked-by: Vincent Mailhol <mailhol.vincent@wanadoo.fr>

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

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

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-21 15:52 [PATCH] can: pch_can: fix uninitialized use of errc Marc Kleine-Budde
2022-07-21 15:56 ` Nathan Chancellor
2022-07-21 16:03 ` Vincent MAILHOL

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.