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-next>] [day] [month] [year] [list]
Date:   Tue, 10 May 2022 16:43:15 +0800
From:   Zheyu Ma <zheyuma97@...il.com>
To:     mturquette@...libre.com, sboyd@...nel.org
Cc:     linux-clk@...r.kernel.org, linux-kernel@...r.kernel.org,
        Zheyu Ma <zheyuma97@...il.com>
Subject: [PATCH] clk: max9485: Register a callback to disable the regulator

The driver should register a callback which can disable the regulator
when it fails to probe.

Signed-off-by: Zheyu Ma <zheyuma97@...il.com>
---
 drivers/clk/clk-max9485.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/drivers/clk/clk-max9485.c b/drivers/clk/clk-max9485.c
index 5f85b0a32872..7f521205fd7b 100644
--- a/drivers/clk/clk-max9485.c
+++ b/drivers/clk/clk-max9485.c
@@ -254,6 +254,13 @@ max9485_of_clk_get(struct of_phandle_args *clkspec, void *data)
 	return &drvdata->hw[idx].hw;
 }
 
+static void max9485_disable_regulator(void *arg)
+{
+	struct max9485_driver_data *drvdata = arg;
+
+	regulator_disable(drvdata->supply);
+}
+
 static int max9485_i2c_probe(struct i2c_client *client)
 {
 	struct max9485_driver_data *drvdata;
@@ -279,6 +286,10 @@ static int max9485_i2c_probe(struct i2c_client *client)
 	if (ret < 0)
 		return ret;
 
+	ret = devm_add_action_or_reset(dev, max9485_disable_regulator, drvdata->supply);
+	if (ret)
+		return ret;
+
 	drvdata->reset_gpio =
 		devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_HIGH);
 	if (IS_ERR(drvdata->reset_gpio))
-- 
2.25.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ