From: Matthias Kaehlcke <mka@chromium.org>
To: Benson Leung <bleung@google.com>
Cc: Jonathan Cameron <jic23@kernel.org>,
Hartmut Knaack <knaack.h@gmx.de>,
Lars-Peter Clausen <lars@metafoo.de>,
Peter Meerwald-Stadler <pmeerw@pmeerw.net>,
Benson Leung <bleung@chromium.org>,
Enric Balletbo i Serra <enric.balletbo@collabora.com>,
Guenter Roeck <groeck@chromium.org>,
linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org,
Gwendal Grignou <gwendal@chromium.org>,
Douglas Anderson <dianders@chromium.org>
Subject: Re: [PATCH] iio: cros_ec_accel_legacy: Always release lock when returning from _read()
Date: Mon, 15 Jul 2019 13:04:47 -0700 [thread overview]
Message-ID: <20190715200447.GT250418@google.com> (raw)
In-Reply-To: <20190715195557.GA29926@google.com>
Hi Benson,
On Mon, Jul 15, 2019 at 12:55:57PM -0700, Benson Leung wrote:
> Hi Matthias,
>
> On Mon, Jul 15, 2019 at 12:10:17PM -0700, Matthias Kaehlcke wrote:
> > Before doing any actual work cros_ec_accel_legacy_read() acquires
> > a mutex, which is released at the end of the function. However for
> > 'calibbias' channels the function returns directly, without releasing
> > the lock. The next attempt to acquire the lock blocks forever. Instead
> > of an explicit return statement use the common return path, which
> > releases the lock.
> >
> > Fixes: 11b86c7004ef1 ("platform/chrome: Add cros_ec_accel_legacy driver")
> > Signed-off-by: Matthias Kaehlcke <mka@chromium.org>
> > ---
> > drivers/iio/accel/cros_ec_accel_legacy.c | 3 ++-
> > 1 file changed, 2 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/iio/accel/cros_ec_accel_legacy.c b/drivers/iio/accel/cros_ec_accel_legacy.c
> > index 46bb2e421bb9..27ca4a64dddf 100644
> > --- a/drivers/iio/accel/cros_ec_accel_legacy.c
> > +++ b/drivers/iio/accel/cros_ec_accel_legacy.c
> > @@ -206,7 +206,8 @@ static int cros_ec_accel_legacy_read(struct iio_dev *indio_dev,
> > case IIO_CHAN_INFO_CALIBBIAS:
> > /* Calibration not supported. */
> > *val = 0;
> > - return IIO_VAL_INT;
> > + ret = IIO_VAL_INT;
> > + break;
>
> The value of ret is not used below this. It seems to be only used in
> case IIO_CHAN_INFO_RAW. In fact, with your change,
> there's no return value at all and we just reach the end of
> cros_ec_accel_legacy_read.
>
> > default:
> > return -EINVAL;
> > }
>
I messed up. I was over-confident that a FROMLIST patch in our 4.19
kernel + this patch applying on upstream means that upstream uses the
same code. I should have double-checked that the upstream context is
actually the same.
Sorry for the noise.
next prev parent reply other threads:[~2019-07-15 20:04 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-15 19:10 [PATCH] iio: cros_ec_accel_legacy: Always release lock when returning from _read() Matthias Kaehlcke
2019-07-15 19:40 ` Doug Anderson
2019-07-15 19:50 ` Matthias Kaehlcke
2019-07-15 19:55 ` Benson Leung
2019-07-15 20:04 ` Matthias Kaehlcke [this message]
2019-07-15 23:17 ` Gwendal Grignou
2019-07-15 23:19 ` Gwendal Grignou
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=20190715200447.GT250418@google.com \
--to=mka@chromium.org \
--cc=bleung@chromium.org \
--cc=bleung@google.com \
--cc=dianders@chromium.org \
--cc=enric.balletbo@collabora.com \
--cc=groeck@chromium.org \
--cc=gwendal@chromium.org \
--cc=jic23@kernel.org \
--cc=knaack.h@gmx.de \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pmeerw@pmeerw.net \
/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;
as well as URLs for NNTP newsgroup(s).