can: m_can_platform: m_can_plat_probe(): add missing error handling if mcan_class...
authorMarc Kleine-Budde <mkl@pengutronix.de>
Mon, 19 Aug 2019 17:34:28 +0000 (19:34 +0200)
committerMarc Kleine-Budde <mkl@pengutronix.de>
Tue, 20 Aug 2019 11:41:26 +0000 (13:41 +0200)
This patch adds the missing error handling in m_can_plat_probe() if
mcan_class is NULL.

Fixes: f524f829b75a ("can: m_can: Create a m_can platform framework")
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
drivers/net/can/m_can/m_can_platform.c

index 2c6ef861d4a2ec9936d228b7591990d85c5f84af..6ac4c35f247a209f181df6bfd337ec655a0fa34e 100644 (file)
@@ -63,6 +63,9 @@ static int m_can_plat_probe(struct platform_device *pdev)
        int irq, ret = 0;
 
        mcan_class = m_can_class_allocate_dev(&pdev->dev);
+       if (!mcan_class)
+               return -ENOMEM;
+
        priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
        if (!priv)
                return -ENOMEM;