Commit 3e5b3418 authored by Dongliang Mu's avatar Dongliang Mu Committed by Marc Kleine-Budde

can: mscan: mpc5xxx: mpc5xxx_can_probe(): add missing put_clock() in error path

The commit 1149108e ("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: 1149108e ("can: mscan: improve clock API use")
Signed-off-by: default avatarDongliang Mu <dzm91@hust.edu.cn>
Link: https://lore.kernel.org/all/20221024133828.35881-1-mkl@pengutronix.deSigned-off-by: default avatarMarc Kleine-Budde <mkl@pengutronix.de>
parent baee5a14
...@@ -322,14 +322,14 @@ static int mpc5xxx_can_probe(struct platform_device *ofdev) ...@@ -322,14 +322,14 @@ static int mpc5xxx_can_probe(struct platform_device *ofdev)
&mscan_clksrc); &mscan_clksrc);
if (!priv->can.clock.freq) { if (!priv->can.clock.freq) {
dev_err(&ofdev->dev, "couldn't get MSCAN clock properties\n"); 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); err = register_mscandev(dev, mscan_clksrc);
if (err) { if (err) {
dev_err(&ofdev->dev, "registering %s failed (err=%d)\n", dev_err(&ofdev->dev, "registering %s failed (err=%d)\n",
DRV_NAME, err); 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", 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) ...@@ -337,7 +337,9 @@ static int mpc5xxx_can_probe(struct platform_device *ofdev)
return 0; return 0;
exit_free_mscan: exit_put_clock:
if (data->put_clock)
data->put_clock(ofdev);
free_candev(dev); free_candev(dev);
exit_dispose_irq: exit_dispose_irq:
irq_dispose_mapping(irq); irq_dispose_mapping(irq);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment