From: Wang Hai <wangha...@huawei.com>

[ Upstream commit 85496a29224188051b6135eb38da8afd4c584765 ]

Fix the missing clk_disable_unprepare() before return
from gemini_ethernet_port_probe() in the error handling case.

Fixes: 4d5ae32f5e1e ("net: ethernet: Add a driver for Gemini gigabit ethernet")
Reported-by: Hulk Robot <hul...@huawei.com>
Signed-off-by: Wang Hai <wangha...@huawei.com>
Signed-off-by: David S. Miller <da...@davemloft.net>
Signed-off-by: Sasha Levin <sas...@kernel.org>
---
 drivers/net/ethernet/cortina/gemini.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/cortina/gemini.c 
b/drivers/net/ethernet/cortina/gemini.c
index 2814b96751b4f..01ae113f122a0 100644
--- a/drivers/net/ethernet/cortina/gemini.c
+++ b/drivers/net/ethernet/cortina/gemini.c
@@ -2445,6 +2445,7 @@ static int gemini_ethernet_port_probe(struct 
platform_device *pdev)
        port->reset = devm_reset_control_get_exclusive(dev, NULL);
        if (IS_ERR(port->reset)) {
                dev_err(dev, "no reset\n");
+               clk_disable_unprepare(port->pclk);
                return PTR_ERR(port->reset);
        }
        reset_control_reset(port->reset);
@@ -2500,8 +2501,10 @@ static int gemini_ethernet_port_probe(struct 
platform_device *pdev)
                                        IRQF_SHARED,
                                        port_names[port->id],
                                        port);
-       if (ret)
+       if (ret) {
+               clk_disable_unprepare(port->pclk);
                return ret;
+       }
 
        ret = register_netdev(netdev);
        if (!ret) {
-- 
2.25.1



Reply via email to