From: Peter Rosin <peda@lysator.liu.se>
To: Farhad Alemi <farhad.alemi@berkeley.edu>
Cc: falemi@asu.edu, linux-i2c@vger.kernel.org,
linux-kernel@vger.kernel.org, Peter Rosin <peda@lysator.liu.se>
Subject: [PATCH] i2c: mux: avoid WARN on benign symlink creation failures
Date: Sun, 30 Aug 2026 06:13:03 +0200 [thread overview]
Message-ID: <20260830041303.1934825-1-peda@lysator.liu.se> (raw)
In-Reply-To: <CA+0ovCij3QDLRzt8CwpjBy-BbJ5Zf5SV9w9QZXz8uD3Agws31g@mail.gmail.com>
WARN() is a bit harsh and causes a crash for panic-on-warn users. Degrade
the error reporting to ordinary dev_err() calls.
Reported-by: Farhad Alemi <farhad.alemi@berkeley.edu>
Link: https://lore.kernel.org/all/CA+0ovCij3QDLRzt8CwpjBy-BbJ5Zf5SV9w9QZXz8uD3Agws31g@mail.gmail.com/
Signed-off-by: Peter Rosin <peda@lysator.liu.se>
---
Hi Farhad,
I assume this patch helps?
Cheers,
Peter
drivers/i2c/i2c-mux.c | 16 ++++++++++------
1 file changed, 10 insertions(+), 6 deletions(-)
diff --git a/drivers/i2c/i2c-mux.c b/drivers/i2c/i2c-mux.c
index 681a201c239b..52cd8cdf2307 100644
--- a/drivers/i2c/i2c-mux.c
+++ b/drivers/i2c/i2c-mux.c
@@ -393,14 +393,18 @@ int i2c_mux_add_adapter(struct i2c_mux_core *muxc,
}
}
- WARN(sysfs_create_link(&priv->adap.dev.kobj, &muxc->dev->kobj,
- "mux_device"),
- "can't create symlink to mux device\n");
+ ret = sysfs_create_link(&priv->adap.dev.kobj, &muxc->dev->kobj,
+ "mux_device");
+ if (ret)
+ dev_err(muxc->dev, "can't create symlink to mux device\n");
snprintf(symlink_name, sizeof(symlink_name), "channel-%u", chan_id);
- WARN(sysfs_create_link(&muxc->dev->kobj, &priv->adap.dev.kobj,
- symlink_name),
- "can't create symlink to channel %u\n", chan_id);
+ ret = sysfs_create_link(&muxc->dev->kobj, &priv->adap.dev.kobj,
+ symlink_name);
+ if (ret)
+ dev_err(muxc->dev,
+ "can't create symlink to channel %u\n", chan_id);
+
dev_info(&parent->dev, "Added multiplexed i2c bus %d\n",
i2c_adapter_id(&priv->adap));
--
2.55.0
next prev parent reply other threads:[~2026-08-30 4:14 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-28 5:49 [BUG] WARNING in i2c_mux_add_adapter Farhad Alemi
2026-08-30 4:13 ` Peter Rosin [this message]
2026-08-30 19:13 ` [PATCH] i2c: mux: avoid WARN on benign symlink creation failures Andi Shyti
2026-08-30 21:14 ` Peter Rosin
2026-09-08 4:23 ` Farhad Alemi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260830041303.1934825-1-peda@lysator.liu.se \
--to=peda@lysator.liu.se \
--cc=falemi@asu.edu \
--cc=farhad.alemi@berkeley.edu \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®