diff options
author | Marc Kleine-Budde <mkl@pengutronix.de> | 2019-08-19 19:34:28 +0200 |
---|---|---|
committer | Marc Kleine-Budde <mkl@pengutronix.de> | 2019-08-20 13:41:26 +0200 |
commit | 7fbda1306542d89984547faf6bfce584e182a541 (patch) | |
tree | 8e51039cc175296e5b1d1dce1942131006e1f9ee /drivers/net | |
parent | ad07819f223e26b30cc5ec25a31d906db0788600 (diff) |
can: tcan4x5x: tcan4x5x_can_probe(): add missing error handling if mcan_class is NULL
This patch adds the missing error handling in tcan4x5x_can_probe() if
mcan_class is NULL.
Fixes: 5443c226ba91 ("can: tcan4x5x: Add tcan4x5x driver to the kernel")
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/can/m_can/tcan4x5x.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/net/can/m_can/tcan4x5x.c b/drivers/net/can/m_can/tcan4x5x.c index a2d5e501a502..7a73a4cfc1bb 100644 --- a/drivers/net/can/m_can/tcan4x5x.c +++ b/drivers/net/can/m_can/tcan4x5x.c @@ -414,6 +414,9 @@ static int tcan4x5x_can_probe(struct spi_device *spi) int freq, ret; mcan_class = m_can_class_allocate_dev(&spi->dev); + if (!mcan_class) + return -ENOMEM; + priv = devm_kzalloc(&spi->dev, sizeof(*priv), GFP_KERNEL); if (!priv) return -ENOMEM; |