lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220920103108.23074-16-jay.xu@rock-chips.com>
Date:   Tue, 20 Sep 2022 18:31:03 +0800
From:   Jianqun Xu <jay.xu@...k-chips.com>
To:     linus.walleij@...aro.org, heiko@...ech.de, brgl@...ev.pl,
        andriy.shevchenko@...ux.intel.com
Cc:     robert.moore@...el.com, robh@...nel.org,
        linux-rockchip@...ts.infradead.org, linux-kernel@...r.kernel.org,
        lenb@...nel.org, rafael@...nel.org,
        Jianqun Xu <jay.xu@...k-chips.com>
Subject: [PATCH 15/20] gpio/rockchip: disable and put clocks when gpiolib register failed

When gpiolib register failed, the clocks should be disabled and put.

Signed-off-by: Jianqun Xu <jay.xu@...k-chips.com>
---
 drivers/gpio/gpio-rockchip.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/drivers/gpio/gpio-rockchip.c b/drivers/gpio/gpio-rockchip.c
index 4fcd75d710c1..09ed5c880dde 100644
--- a/drivers/gpio/gpio-rockchip.c
+++ b/drivers/gpio/gpio-rockchip.c
@@ -746,14 +746,21 @@ static int rockchip_gpio_probe(struct platform_device *pdev)
 
 	ret = rockchip_gpiolib_register(bank);
 	if (ret) {
-		clk_disable_unprepare(bank->clk);
-		return ret;
+		dev_err(bank->dev, "Failed to register gpio %d\n", ret);
+		goto err_put_clk;
 	}
 
 	platform_set_drvdata(pdev, bank);
 	dev_info(dev, "probed %pOF\n", np);
 
 	return 0;
+err_put_clk:
+	clk_put(bank->clk);
+	clk_put(bank->db_clk);
+	clk_disable_unprepare(bank->clk);
+	clk_disable_unprepare(bank->db_clk);
+
+	return ret;
 }
 
 static int rockchip_gpio_remove(struct platform_device *pdev)
-- 
2.25.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ