projects
/
platform
/
kernel
/
linux-starfive.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
18abe5f
)
mfd: stmfx: Nullify stmfx->vdd in case of error
author
Amelie Delaunay
<amelie.delaunay@foss.st.com>
Fri, 9 Jun 2023 09:28:04 +0000
(11:28 +0200)
committer
Greg Kroah-Hartman
<gregkh@linuxfoundation.org>
Wed, 19 Jul 2023 14:21:57 +0000
(16:21 +0200)
[ Upstream commit
7c81582c0bccb4757186176f0ee12834597066ad
]
Nullify stmfx->vdd in case devm_regulator_get_optional() returns an error.
And simplify code by returning an error only if return code is not -ENODEV,
which means there is no vdd regulator and it is not an issue.
Fixes:
d75846ed08e6
("mfd: stmfx: Fix dev_err_probe() call in stmfx_chip_init()")
Signed-off-by: Amelie Delaunay <amelie.delaunay@foss.st.com>
Link:
https://lore.kernel.org/r/20230609092804.793100-2-amelie.delaunay@foss.st.com
Signed-off-by: Lee Jones <lee@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/mfd/stmfx.c
patch
|
blob
|
history
diff --git
a/drivers/mfd/stmfx.c
b/drivers/mfd/stmfx.c
index
61a8aad
..
b1ecd85
100644
(file)
--- a/
drivers/mfd/stmfx.c
+++ b/
drivers/mfd/stmfx.c
@@
-330,9
+330,8
@@
static int stmfx_chip_init(struct i2c_client *client)
stmfx->vdd = devm_regulator_get_optional(&client->dev, "vdd");
ret = PTR_ERR_OR_ZERO(stmfx->vdd);
if (ret) {
- if (ret == -ENODEV)
- stmfx->vdd = NULL;
- else
+ stmfx->vdd = NULL;
+ if (ret != -ENODEV)
return dev_err_probe(&client->dev, ret, "Failed to get VDD regulator\n");
}