]> git.baikalelectronics.ru Git - kernel.git/commit
can: janz-ican3: initialize dlc variable
authorTom Rix <trix@redhat.com>
Sat, 8 Jan 2022 14:33:19 +0000 (06:33 -0800)
committerMarc Kleine-Budde <mkl@pengutronix.de>
Sat, 8 Jan 2022 19:17:41 +0000 (20:17 +0100)
commita6b0c8ae018a1aff3bb9340914d05ceac99d777c
treea2ca8dd514c69b2157e6e92c81b73febddd6fa56
parentc5e3ddce4d8e2208a7307af4a8b4ca4859f3298e
can: janz-ican3: initialize dlc variable

Clang static analysis reports this problem
janz-ican3.c:1311:2: warning: Undefined or garbage value returned to caller
        return dlc;
        ^~~~~~~~~~

dlc is only set with this conditional
if (!(cf->can_id & CAN_RTR_FLAG))
dlc = cf->len;

But is always returned.  So initialize dlc to 0.

Fixes: b01d5543f78d ("can: do not increase tx_bytes statistics for RTR frames")
Link: https://lore.kernel.org/all/20220108143319.3986923-1-trix@redhat.com
Signed-off-by: Tom Rix <trix@redhat.com>
Acked-by: Vincent Mailhol <mailhol.vincent@wanadoo.fr>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
drivers/net/can/janz-ican3.c