Commit d75846ed authored by Amelie Delaunay's avatar Amelie Delaunay Committed by Lee Jones

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: 41c9c06c ("mfd: stmfx: Simplify with dev_err_probe()")
Signed-off-by: default avatarAmelie Delaunay <amelie.delaunay@st.com>
Signed-off-by: default avatarLee Jones <lee.jones@linaro.org>
parent de129281
......@@ -329,11 +329,11 @@ 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 == -ENODEV) {
if (ret) {
if (ret == -ENODEV)
stmfx->vdd = NULL;
} else {
return dev_err_probe(&client->dev, ret,
"Failed to get VDD regulator\n");
else
return dev_err_probe(&client->dev, ret, "Failed to get VDD regulator\n");
}
if (stmfx->vdd) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment