diff options
author | Marc Kleine-Budde <mkl@pengutronix.de> | 2021-08-03 16:32:01 +0200 |
---|---|---|
committer | Marc Kleine-Budde <mkl@pengutronix.de> | 2022-02-24 08:46:59 +0100 |
commit | fa0b68df7c95043685f339cf27d2539c001a21fd (patch) | |
tree | 3658125e2ab79d022fe7a253270a1abcd06cdfac /drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c | |
parent | 62713f0d9a38f2e0b772e6448adfa9c405316237 (diff) |
can: mcp251xfd: ring: mcp251xfd_ring_init(): checked RAM usage of ring setup
With this patch the usage of the on-chip RAM is checked. In the
current driver the FIFO setup is fixed and always fits into the RAM.
With an upcoming patch series the ring and FIFO setup will be more
dynamic. Although using more RAM than available should not happen, but
add this safety check, just in case.
Link: https://lore.kernel.org/all/20220217103826.2299157-6-mkl@pengutronix.de
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Diffstat (limited to 'drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c')
-rw-r--r-- | drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c b/drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c index e5641696cdc2..2d033d12cdbb 100644 --- a/drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c +++ b/drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c @@ -760,7 +760,9 @@ static int mcp251xfd_chip_start(struct mcp251xfd_priv *priv) if (err) goto out_chip_stop; - mcp251xfd_ring_init(priv); + err = mcp251xfd_ring_init(priv); + if (err) + goto out_chip_stop; err = mcp251xfd_chip_fifo_init(priv); if (err) |