diff mbox

i2c: fix "failed to add mux-adapter" message

Message ID E1dAaIY-0005jy-Tc@rmk-PC.armlinux.org.uk
State Superseded
Headers show

Commit Message

Russell King (Oracle) May 16, 2017, 11:05 a.m. UTC
i2c-mux always prints the "failed to add mux-adapter" message even when
the mux adapter is successfully registered.  Fix this.

Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
---
 drivers/i2c/i2c-mux.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

Comments

Peter Rosin May 16, 2017, 11:10 a.m. UTC | #1
On 2017-05-16 13:05, Russell King wrote:
> i2c-mux always prints the "failed to add mux-adapter" message even when
> the mux adapter is successfully registered.  Fix this.

Yes, sorry about that. However, a similar fix [1] is already queued.

Cheers,
peda

[1] https://lkml.org/lkml/2017/5/15/62
--
To unsubscribe from this list: send the line "unsubscribe linux-i2c" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/i2c/i2c-mux.c b/drivers/i2c/i2c-mux.c
index 26f7237558ba..d5258c13fe57 100644
--- a/drivers/i2c/i2c-mux.c
+++ b/drivers/i2c/i2c-mux.c
@@ -395,14 +395,16 @@  int i2c_mux_add_adapter(struct i2c_mux_core *muxc,
 	if (force_nr) {
 		priv->adap.nr = force_nr;
 		ret = i2c_add_numbered_adapter(&priv->adap);
-		dev_err(&parent->dev,
-			"failed to add mux-adapter %u as bus %u (error=%d)\n",
-			chan_id, force_nr, ret);
+		if (ret < 0)
+			dev_err(&parent->dev,
+				"failed to add mux-adapter %u as bus %u (error=%d)\n",
+				chan_id, force_nr, ret);
 	} else {
 		ret = i2c_add_adapter(&priv->adap);
-		dev_err(&parent->dev,
-			"failed to add mux-adapter %u (error=%d)\n",
-			chan_id, ret);
+		if (ret < 0)
+			dev_err(&parent->dev,
+				"failed to add mux-adapter %u (error=%d)\n",
+				chan_id, ret);
 	}
 	if (ret < 0) {
 		kfree(priv);