1
0
Fork 0
mirror of synced 2025-03-06 20:59:54 +01:00

mfd: stmfx: Fix dev_err_probe() call in stmfx_chip_init()

'ret' may be 0 so, dev_err_probe() should be called only when 'ret' is
an error code.

Fixes: 41c9c06c49 ("mfd: stmfx: Simplify with dev_err_probe()")
Signed-off-by: Amelie Delaunay <amelie.delaunay@st.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
This commit is contained in:
Amelie Delaunay 2020-11-13 13:27:25 +01:00 committed by Lee Jones
parent de1292817c
commit d75846ed08

View file

@ -329,11 +329,11 @@ static int stmfx_chip_init(struct i2c_client *client)
stmfx->vdd = devm_regulator_get_optional(&client->dev, "vdd"); stmfx->vdd = devm_regulator_get_optional(&client->dev, "vdd");
ret = PTR_ERR_OR_ZERO(stmfx->vdd); ret = PTR_ERR_OR_ZERO(stmfx->vdd);
if (ret == -ENODEV) { if (ret) {
stmfx->vdd = NULL; if (ret == -ENODEV)
} else { stmfx->vdd = NULL;
return dev_err_probe(&client->dev, ret, else
"Failed to get VDD regulator\n"); return dev_err_probe(&client->dev, ret, "Failed to get VDD regulator\n");
} }
if (stmfx->vdd) { if (stmfx->vdd) {