lkml.org 
[lkml]   [2023]   [Feb]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH v2 1/2] hwmon: g762: add a check of devm_add_action in g762_of_clock_enable
Date
From: Kang Chen <void0red@gmail.com>

devm_add_action may fails, check it and do the cleanup.

Signed-off-by: Kang Chen <void0red@gmail.com>
---
v2 -> v1: split the patch

drivers/hwmon/g762.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/hwmon/g762.c b/drivers/hwmon/g762.c
index 64a0599b2..e2c3c34f0 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:
--
2.34.1
\
 
 \ /
  Last update: 2023-03-27 00:36    [W:0.065 / U:0.576 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site