mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Joshua Crofts <joshua.crofts1@gmail.com>
Cc: "Salah Triki" <salah.triki@gmail.com>,
	"David Lechner" <dlechner@baylibre.com>,
	"Nuno Sá" <nuno.sa@analog.com>,
	"Andy Shevchenko" <andy@kernel.org>,
	linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3] iio: temperature: tsys02d: Fix state desynchronization on resolution write error
Date: Sun, 18 Oct 2026 23:51:06 +0100	[thread overview]
Message-ID: <20261018235106.06f3ed48@jic23-hlaptop> (raw)
In-Reply-To: <20261005161950.000066da@gmail.com>

On Mon, 5 Oct 2026 16:19:50 +0200
Joshua Crofts <joshua.crofts1@gmail.com> wrote:

> On Mon,  5 Oct 2026 14:20:02 +0100
> Salah Triki <salah.triki@gmail.com> wrote:
> 
> > In tsys02d_write_raw(), dev_data->res_index is updated before checking
> > the return value of ms_sensors_write_resolution(). If the hardware I2C
> > write operation fails, dev_data->res_index remains updated with the
> > new index despite the physical sensor remaining in its previous state.
> > 
> > This leads to a state desynchronization where subsequent reads via
> > tsys02d_read_raw() return an incorrect sampling frequency.
> > 
> > Fix this by handling the error path first, updating dev_data->res_index
> > only on success, and using guard(mutex) to clean up locking.
> > 
> > This was found through manual code review.
> > 
> > Fixes: 53bf4d067d51 ("Add tsys02d meas-spec driver support")
> > Signed-off-by: Salah Triki <salah.triki@gmail.com>
> > ---  
> 
> Makes sense.
> 
> Reviewed-by: Joshua Crofts <joshua.crofts1@gmail.com>
> 
I'll take this one the slow path given it is a fix for an error
case we don't really expect to see.

Applied to the testing branch of iio.git.

Thanks,

Jonathan


      reply	other threads:[~2026-10-18 22:51 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-05 13:20 Salah Triki
2026-10-05 14:19 ` Joshua Crofts
2026-10-18 22:51   ` 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=20261018235106.06f3ed48@jic23-hlaptop \
    --to=jic23@kernel.org \
    --cc=andy@kernel.org \
    --cc=dlechner@baylibre.com \
    --cc=joshua.crofts1@gmail.com \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nuno.sa@analog.com \
    --cc=salah.triki@gmail.com \
    /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®