mirror of
https://github.com/torvalds/linux.git
synced 2024-12-29 14:21:47 +00:00
net: mscc: ocelot: Fix a resource leak in the error handling path of the probe function
In case of error after calling 'ocelot_init()', it must be undone by a
corresponding 'ocelot_deinit()' call, as already done in the remove
function.
Fixes: a556c76adc
("net: mscc: Add initial Ocelot switch support")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Acked-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Link: https://lore.kernel.org/r/20201213114838.126922-1-christophe.jaillet@wanadoo.fr
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
parent
c18e68696f
commit
f87675b836
@ -1267,7 +1267,7 @@ static int mscc_ocelot_probe(struct platform_device *pdev)
|
||||
|
||||
err = mscc_ocelot_init_ports(pdev, ports);
|
||||
if (err)
|
||||
goto out_put_ports;
|
||||
goto out_ocelot_deinit;
|
||||
|
||||
if (ocelot->ptp) {
|
||||
err = ocelot_init_timestamp(ocelot, &ocelot_ptp_clock_info);
|
||||
@ -1282,8 +1282,14 @@ static int mscc_ocelot_probe(struct platform_device *pdev)
|
||||
register_switchdev_notifier(&ocelot_switchdev_nb);
|
||||
register_switchdev_blocking_notifier(&ocelot_switchdev_blocking_nb);
|
||||
|
||||
of_node_put(ports);
|
||||
|
||||
dev_info(&pdev->dev, "Ocelot switch probed\n");
|
||||
|
||||
return 0;
|
||||
|
||||
out_ocelot_deinit:
|
||||
ocelot_deinit(ocelot);
|
||||
out_put_ports:
|
||||
of_node_put(ports);
|
||||
return err;
|
||||
|
Loading…
Reference in New Issue
Block a user