Commit 9fce894d authored by Peter Rosin's avatar Peter Rosin

i2c: mux: only print failure message on error

As is, a failure message is printed unconditionally, which is confusing.
And noisy.

Fixes: 8d4d159f ("i2c: mux: provide more info on failure in i2c_mux_add_adapter")
Signed-off-by: default avatarPeter Rosin <peda@axentia.se>
parent a36d4637
...@@ -395,18 +395,20 @@ int i2c_mux_add_adapter(struct i2c_mux_core *muxc, ...@@ -395,18 +395,20 @@ int i2c_mux_add_adapter(struct i2c_mux_core *muxc,
if (force_nr) { if (force_nr) {
priv->adap.nr = force_nr; priv->adap.nr = force_nr;
ret = i2c_add_numbered_adapter(&priv->adap); ret = i2c_add_numbered_adapter(&priv->adap);
dev_err(&parent->dev, if (ret < 0) {
"failed to add mux-adapter %u as bus %u (error=%d)\n", dev_err(&parent->dev,
chan_id, force_nr, ret); "failed to add mux-adapter %u as bus %u (error=%d)\n",
chan_id, force_nr, ret);
goto err_free_priv;
}
} else { } else {
ret = i2c_add_adapter(&priv->adap); ret = i2c_add_adapter(&priv->adap);
dev_err(&parent->dev, if (ret < 0) {
"failed to add mux-adapter %u (error=%d)\n", dev_err(&parent->dev,
chan_id, ret); "failed to add mux-adapter %u (error=%d)\n",
} chan_id, ret);
if (ret < 0) { goto err_free_priv;
kfree(priv); }
return ret;
} }
WARN(sysfs_create_link(&priv->adap.dev.kobj, &muxc->dev->kobj, WARN(sysfs_create_link(&priv->adap.dev.kobj, &muxc->dev->kobj,
...@@ -422,6 +424,10 @@ int i2c_mux_add_adapter(struct i2c_mux_core *muxc, ...@@ -422,6 +424,10 @@ int i2c_mux_add_adapter(struct i2c_mux_core *muxc,
muxc->adapter[muxc->num_adapters++] = &priv->adap; muxc->adapter[muxc->num_adapters++] = &priv->adap;
return 0; return 0;
err_free_priv:
kfree(priv);
return ret;
} }
EXPORT_SYMBOL_GPL(i2c_mux_add_adapter); EXPORT_SYMBOL_GPL(i2c_mux_add_adapter);
......
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