All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tzung-Bi Shih <tzungbi@kernel.org>
To: Lee Jones <lee@kernel.org>
Cc: Andrei Kuchynski <akuchynski@chromium.org>,
	Benson Leung <bleung@chromium.org>,
	Guenter Roeck <groeck@chromium.org>,
	Gwendal Grignou <gwendal@chromium.org>,
	chrome-platform@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 2/2] mfd: cros_ec: Read EC features during probe to catch transfer error
Date: Thu, 18 Jun 2026 09:31:43 +0000	[thread overview]
Message-ID: <ajO6_zXQKxbdCxhz@google.com> (raw)
In-Reply-To: <20260618084037.GA1672911@google.com>

On Thu, Jun 18, 2026 at 09:40:37AM +0100, Lee Jones wrote:
> On Mon, 08 Jun 2026, Andrei Kuchynski wrote:
> 
> > cros_ec_check_features() does not return an error if the underlying
> > EC_CMD_GET_FEATURES command fails. Consequently, when the Fingerprint
> > device fails to respond, the probe function ignores the failure and falls
> > back to installing it as 'cros_ec' device instead of 'cros_fp'.
> > This leads to a sysfs duplicate filename collision later when the real
> > 'cros_ec' device attempts to register:
> > 
> >   cros-ec-spi spi5.0: EC failed to respond in time
> >   cros-ec-dev.19.auto: cannot get EC features: -110
> >   sysfs : cannot create duplicate filename '/class/chromeos/cros_ec'
> >         : sysfs_do_create_link_sd+0x94/0xdc
> >         : ec_device_probe+0x150/0x4f0
> > 
> > Fix this by explicitly calling the newly introduced cros_ec_read_features()
> > function. If the transfer fails, abort the broken device initialization.
> > Move the initialization of class_dev before this call to prevent a missing
> > release() callback warning on the error path.
> > 
> > Signed-off-by: Andrei Kuchynski <akuchynski@chromium.org>
> > ---
> >  drivers/mfd/cros_ec_dev.c | 18 +++++++++++-------
> >  1 file changed, 11 insertions(+), 7 deletions(-)
> > 
> > diff --git a/drivers/mfd/cros_ec_dev.c b/drivers/mfd/cros_ec_dev.c
> > index 39430dd44e30c..a8c6300248d59 100644
> > --- a/drivers/mfd/cros_ec_dev.c
> > +++ b/drivers/mfd/cros_ec_dev.c
> > @@ -203,6 +203,17 @@ static int ec_device_probe(struct platform_device *pdev)
> >  	ec->features.flags[1] = -1U; /* Not cached yet */
> >  	device_initialize(&ec->class_dev);
> >  
> > +	/*
> > +	 * Add the class device
> > +	 */
> > +	ec->class_dev.class = &cros_class;
> > +	ec->class_dev.parent = dev;
> > +	ec->class_dev.release = cros_ec_class_release;
> > +
> > +	retval = cros_ec_read_features(ec);
> 
> This depends on the other patch.
> 
> Once it's been Reviewed / Acked, I'd be happy to take both and submit an IB.

FWIW: I gave my A-b tag in v1 and it has been carried to [PATCH v2 1/2]
platform/chrome: cros_ec_proto: Introduce cros_ec_read_features helper.

  reply	other threads:[~2026-06-18  9:31 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-08 21:15 [PATCH v2 0/2] mfd: platform/chrome: Catch EC feature read errors during probe Andrei Kuchynski
2026-06-08 21:15 ` [PATCH v2 1/2] platform/chrome: cros_ec_proto: Introduce cros_ec_read_features helper Andrei Kuchynski
2026-06-08 21:15 ` [PATCH v2 2/2] mfd: cros_ec: Read EC features during probe to catch transfer error Andrei Kuchynski
2026-06-18  8:40   ` Lee Jones
2026-06-18  9:31     ` Tzung-Bi Shih [this message]
2026-06-18 11:21       ` Lee Jones

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=ajO6_zXQKxbdCxhz@google.com \
    --to=tzungbi@kernel.org \
    --cc=akuchynski@chromium.org \
    --cc=bleung@chromium.org \
    --cc=chrome-platform@lists.linux.dev \
    --cc=groeck@chromium.org \
    --cc=gwendal@chromium.org \
    --cc=lee@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.