From: Jonathan Cameron <jic23@kernel.org>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Lorenzo Bianconi <lorenzo.bianconi83@gmail.com>,
Hartmut Knaack <knaack.h@gmx.de>,
Lars-Peter Clausen <lars@metafoo.de>,
Peter Meerwald-Stadler <pmeerw@pmeerw.net>,
linux-iio@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] iio: imu: st_lsm6dsx: unlock on error in st_lsm6dsx_shub_write_raw()
Date: Sat, 25 Apr 2020 18:34:36 +0100 [thread overview]
Message-ID: <20200425183436.2d22db77@archlinux> (raw)
In-Reply-To: <20200422093811.GA196034@mwanda>
On Wed, 22 Apr 2020 12:38:11 +0300
Dan Carpenter <dan.carpenter@oracle.com> wrote:
> We need to release a lock if st_lsm6dsx_check_odr() fails, we can't
> return directly.
>
> Fixes: 76551a3c3df1 ("iio: imu: st_lsm6dsx: specify slave odr in slv_odr")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Good find.
Applied to the fixes-togreg branch of iio.git.
Thanks,
Jonathan
> ---
> drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_shub.c | 7 +++++--
> 1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_shub.c b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_shub.c
> index 64ef07a30726..1cf98195f84d 100644
> --- a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_shub.c
> +++ b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_shub.c
> @@ -544,8 +544,10 @@ st_lsm6dsx_shub_write_raw(struct iio_dev *iio_dev,
>
> ref_sensor = iio_priv(hw->iio_devs[ST_LSM6DSX_ID_ACC]);
> odr = st_lsm6dsx_check_odr(ref_sensor, val, &odr_val);
> - if (odr < 0)
> - return odr;
> + if (odr < 0) {
> + err = odr;
> + goto release;
> + }
>
> sensor->ext_info.slv_odr = val;
> sensor->odr = odr;
> @@ -557,6 +559,7 @@ st_lsm6dsx_shub_write_raw(struct iio_dev *iio_dev,
> break;
> }
>
> +release:
> iio_device_release_direct_mode(iio_dev);
>
> return err;
prev parent reply other threads:[~2020-04-25 17:34 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-22 9:38 [PATCH] iio: imu: st_lsm6dsx: unlock on error in st_lsm6dsx_shub_write_raw() Dan Carpenter
2020-04-25 17:34 ` Jonathan Cameron [this message]
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=20200425183436.2d22db77@archlinux \
--to=jic23@kernel.org \
--cc=dan.carpenter@oracle.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=knaack.h@gmx.de \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=lorenzo.bianconi83@gmail.com \
--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