Linux I2C development
 help / color / mirror / Atom feed
From: Andi Shyti <andi.shyti@kernel.org>
To: Peter Rosin <peda@lysator.liu.se>
Cc: Farhad Alemi <farhad.alemi@berkeley.edu>,
	falemi@asu.edu,  linux-i2c@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] i2c: mux: avoid WARN on benign symlink creation failures
Date: Sun, 30 Aug 2026 21:13:24 +0200	[thread overview]
Message-ID: <apSAfJARPgsbSDYb@zenone.zhora.eu> (raw)
In-Reply-To: <20260830041303.1934825-1-peda@lysator.liu.se>

Hi Peter,

On Sun, Aug 30, 2026 at 06:13:03AM +0200, Peter Rosin wrote:
> 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?

I sent this patch for a quick test:

https://lore.kernel.org/all/20260828135950.454799-1-andi.shyti@kernel.org/

Maybe they can be taken together, as I agree not to fire a WARN()
there.

Andi

> 
> 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
> 

  reply	other threads:[~2026-08-30 19:13 UTC|newest]

Thread overview: 4+ 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 ` [PATCH] i2c: mux: avoid WARN on benign symlink creation failures Peter Rosin
2026-08-30 19:13   ` Andi Shyti [this message]
2026-08-30 21:14     ` Peter Rosin

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=apSAfJARPgsbSDYb@zenone.zhora.eu \
    --to=andi.shyti@kernel.org \
    --cc=falemi@asu.edu \
    --cc=farhad.alemi@berkeley.edu \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peda@lysator.liu.se \
    /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