net: dsa: sja1105: add error handling in sja1105_setup()
authorVladimir Oltean <vladimir.oltean@nxp.com>
Mon, 24 May 2021 09:25:24 +0000 (12:25 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 3 Jun 2021 07:00:38 +0000 (09:00 +0200)
commitdd8609f203448ca6d58ae71461208b3f6b0329b0
tree2e514ced9d172187d48cb740198552e565f3585b
parent4a368bc25ab60a8e87d450327037fa743c88a545
net: dsa: sja1105: add error handling in sja1105_setup()

commit cec279a898a3b004411682f212215ccaea1cd0fb upstream.

If any of sja1105_static_config_load(), sja1105_clocking_setup() or
sja1105_devlink_setup() fails, we can't just return in the middle of
sja1105_setup() or memory will leak. Add a cleanup path.

Fixes: 0a7bdbc23d8a ("net: dsa: sja1105: move devlink param code to sja1105_devlink.c")
Fixes: 8aa9ebccae87 ("net: dsa: Introduce driver for NXP SJA1105 5-port L2 switch")
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/net/dsa/sja1105/sja1105_main.c