]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commit
can: flexcan: flexcan_chip_freeze(): fix chip freeze for missing bitrate
authorAngelo Dureghello <angelo@kernel-space.org>
Mon, 15 Mar 2021 23:15:10 +0000 (00:15 +0100)
committerMarc Kleine-Budde <mkl@pengutronix.de>
Tue, 16 Mar 2021 07:41:26 +0000 (08:41 +0100)
commit47c5e474bc1e1061fb037d13b5000b38967eb070
treef874d294aefa2709de64088360ced275be435aeb
parent59ec7b89ed3e921cd0625a8c83f31a30d485fdf8
can: flexcan: flexcan_chip_freeze(): fix chip freeze for missing bitrate

For cases when flexcan is built-in, bitrate is still not set at
registering. So flexcan_chip_freeze() generates:

[    1.860000] *** ZERO DIVIDE ***   FORMAT=4
[    1.860000] Current process id is 1
[    1.860000] BAD KERNEL TRAP: 00000000
[    1.860000] PC: [<402e70c8>] flexcan_chip_freeze+0x1a/0xa8

To allow chip freeze, using an hardcoded timeout when bitrate is still
not set.

Fixes: ec15e27cc890 ("can: flexcan: enable RX FIFO after FRZ/HALT valid")
Link: https://lore.kernel.org/r/20210315231510.650593-1-angelo@kernel-space.org
Signed-off-by: Angelo Dureghello <angelo@kernel-space.org>
[mkl: use if instead of ? operator]
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
drivers/net/can/flexcan.c