linux/drivers/net/can
Vincent Mailhol a7a7488cb1 can: pch_can: pch_can_error(): initialize errc before using it
[ Upstream commit 9950f11211 ]

After commit 3a5c7e4611, the variable errc is accessed before being
initialized, c.f. below W=2 warning:

| In function 'pch_can_error',
|     inlined from 'pch_can_poll' at drivers/net/can/pch_can.c:739:4:
| drivers/net/can/pch_can.c:501:29: warning: 'errc' may be used uninitialized [-Wmaybe-uninitialized]
|   501 |                 cf->data[6] = errc & PCH_TEC;
|       |                             ^
| drivers/net/can/pch_can.c: In function 'pch_can_poll':
| drivers/net/can/pch_can.c:484:13: note: 'errc' was declared here
|   484 |         u32 errc, lec;
|       |             ^~~~

Moving errc initialization up solves this issue.

Fixes: 3a5c7e4611 ("can: pch_can: do not report txerr and rxerr during bus-off")
Reported-by: Nathan Chancellor <nathan@kernel.org>
Signed-off-by: Vincent Mailhol <mailhol.vincent@wanadoo.fr>
Reviewed-by: Nathan Chancellor <nathan@kernel.org>
Link: https://lore.kernel.org/all/20220721160032.9348-1-mailhol.vincent@wanadoo.fr
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2022-08-21 15:15:49 +02:00
..
c_can can: c_can: move runtime PM enable/disable to c_can_platform 2021-03-30 14:32:00 +02:00
cc770
dev net: introduce CAN specific pointer in the struct net_device 2021-04-07 15:00:07 +02:00
ifi_canfd
m_can can: m_can: m_can_tx_handler(): fix use after free of skb 2022-04-08 14:40:44 +02:00
mscan
peak_canfd can: peak_pciefd: pucan_handle_status(): fix a potential starvation issue in TX path 2021-07-14 16:55:41 +02:00
rcar can: rcar_can: do not report txerr and rxerr during bus-off 2022-08-21 15:15:48 +02:00
sja1000 can: sja1000: do not report txerr and rxerr during bus-off 2022-08-21 15:15:48 +02:00
softing can: softing: softing_startstop(): fix set but not used variable warning 2022-01-27 10:54:03 +01:00
spi can: hi311x: do not report txerr and rxerr during bus-off 2022-08-21 15:15:48 +02:00
usb can: usb_8dev: do not report txerr and rxerr during bus-off 2022-08-21 15:15:49 +02:00
at91_can.c
flexcan.c
grcan.c can: grcan: grcan_probe(): remove extra of_node_get() 2022-07-12 16:32:16 +02:00
janz-ican3.c
Kconfig
kvaser_pciefd.c can: kvaser_pciefd: kvaser_pciefd_rx_error_frame(): increase correct stats->{rx,tx}_errors counter 2021-12-14 11:32:35 +01:00
led.c
Makefile can: dev: move driver related infrastructure into separate subdir 2021-04-07 15:00:07 +02:00
pch_can.c can: pch_can: pch_can_error(): initialize errc before using it 2022-08-21 15:15:49 +02:00
slcan.c net: introduce CAN specific pointer in the struct net_device 2021-04-07 15:00:07 +02:00
sun4i_can.c can: sun4i_can: do not report txerr and rxerr during bus-off 2022-08-21 15:15:48 +02:00
ti_hecc.c
vcan.c net: introduce CAN specific pointer in the struct net_device 2021-04-07 15:00:07 +02:00
vxcan.c vxcan: enable local echo for sent CAN frames 2022-04-08 14:40:20 +02:00
xilinx_can.c Revert "can: xilinx_can: Limit CANFD brp to 2" 2022-07-21 21:20:17 +02:00