aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mfd
diff options
context:
space:
mode:
authorAmelie Delaunay <amelie.delaunay@foss.st.com>2023-06-09 11:28:04 +0200
committerLee Jones <lee@kernel.org>2023-06-15 15:05:49 +0100
commit7c81582c0bccb4757186176f0ee12834597066ad (patch)
treef3ce6c62228003039c55fd32b4955eb27b6c9d57 /drivers/mfd
parentf592cf624531286f8b52e40dcfc157a5a7fb115c (diff)
downloadlinux-7c81582c0bccb4757186176f0ee12834597066ad.tar.gz
mfd: stmfx: Nullify stmfx->vdd in case of error
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>
Diffstat (limited to 'drivers/mfd')
-rw-r--r--drivers/mfd/stmfx.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/drivers/mfd/stmfx.c b/drivers/mfd/stmfx.c
index 54cc902cb57852..c02cbd9c2f5d79 100644
--- 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");
}