can: mscan: mpc5xxx: mpc5xxx_can_probe(): add missing put_clock() in error path
authorDongliang Mu <dzm91@hust.edu.cn>
Mon, 24 Oct 2022 11:48:07 +0000 (19:48 +0800)
committerMarc Kleine-Budde <mkl@pengutronix.de>
Tue, 25 Oct 2022 07:13:14 +0000 (09:13 +0200)
The commit 1149108e2fbf ("can: mscan: improve clock API use") only
adds put_clock() in mpc5xxx_can_remove() function, forgetting to add
put_clock() in the error handling code.

Fix this bug by adding put_clock() in the error handling code.

Fixes: 1149108e2fbf ("can: mscan: improve clock API use")
Signed-off-by: Dongliang Mu <dzm91@hust.edu.cn>
Link: https://lore.kernel.org/all/20221024133828.35881-1-mkl@pengutronix.de
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
drivers/net/can/mscan/mpc5xxx_can.c

index c469b2f..b0ed798 100644 (file)
@@ -322,14 +322,14 @@ static int mpc5xxx_can_probe(struct platform_device *ofdev)
                                               &mscan_clksrc);
        if (!priv->can.clock.freq) {
                dev_err(&ofdev->dev, "couldn't get MSCAN clock properties\n");
-               goto exit_free_mscan;
+               goto exit_put_clock;
        }
 
        err = register_mscandev(dev, mscan_clksrc);
        if (err) {
                dev_err(&ofdev->dev, "registering %s failed (err=%d)\n",
                        DRV_NAME, err);
-               goto exit_free_mscan;
+               goto exit_put_clock;
        }
 
        dev_info(&ofdev->dev, "MSCAN at 0x%p, irq %d, clock %d Hz\n",
@@ -337,7 +337,9 @@ static int mpc5xxx_can_probe(struct platform_device *ofdev)
 
        return 0;
 
-exit_free_mscan:
+exit_put_clock:
+       if (data->put_clock)
+               data->put_clock(ofdev);
        free_candev(dev);
 exit_dispose_irq:
        irq_dispose_mapping(irq);