mirror of
https://github.com/torvalds/linux.git
synced 2024-11-25 13:41:51 +00:00
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: d75846ed08
("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>
This commit is contained in:
parent
f592cf6245
commit
7c81582c0b
@ -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");
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user