summaryrefslogtreecommitdiff
path: root/drivers/hwmon/g762.c
diff options
context:
space:
mode:
authorKang Chen <void0red@gmail.com>2023-02-27 06:09:12 +0300
committerGuenter Roeck <linux@roeck-us.net>2023-04-19 17:08:31 +0300
commit92e58a87a26cd2fd7c12165e68d5bd53c8cfb122 (patch)
treef40133c5cb74650dd99e5d64eaac5ea023f67125 /drivers/hwmon/g762.c
parentdbfeafdad31c52da8965819a298ed3b0127025e7 (diff)
downloadlinux-92e58a87a26cd2fd7c12165e68d5bd53c8cfb122.tar.xz
hwmon: (g762) add a check of devm_add_action in g762_of_clock_enable
devm_add_action may fails, check it and do the cleanup. Signed-off-by: Kang Chen <void0red@gmail.com> Link: https://lore.kernel.org/r/20230227030913.893004-1-void0red@gmail.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Diffstat (limited to 'drivers/hwmon/g762.c')
-rw-r--r--drivers/hwmon/g762.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/hwmon/g762.c b/drivers/hwmon/g762.c
index 64a0599b2da5..e2c3c34f06e8 100644
--- a/drivers/hwmon/g762.c
+++ b/drivers/hwmon/g762.c
@@ -620,7 +620,12 @@ static int g762_of_clock_enable(struct i2c_client *client)
data = i2c_get_clientdata(client);
data->clk = clk;
- devm_add_action(&client->dev, g762_of_clock_disable, data);
+ ret = devm_add_action(&client->dev, g762_of_clock_disable, data);
+ if (ret) {
+ dev_err(&client->dev, "failed to add disable clock action\n");
+ goto clk_unprep;
+ }
+
return 0;
clk_unprep: