Re: [PATCH v2 2/2] i2c: tegra: make tegra_i2c_mutex_unlock() return void
From: Thierry Reding
Date: Fri May 08 2026 - 06:25:18 EST
On Thu, May 07, 2026 at 10:11:45PM +0000, Saurav Sachidanand wrote:
> tegra_i2c_mutex_unlock() returning an error that overwrites the transfer
> result causes silent loss of I2C transfer errors. If the transfer failed
> but the unlock succeeded, the error was lost and the function incorrectly
> reported success.
>
> Rather than propagating the unlock error (which is not actionable by the
> caller - the I2C message may have been sent regardless), convert the
> function to return void and WARN on the unexpected condition. If the
> unlock fails, subsequent lock attempts will fail anyway, making the error
> visible on the next transfer.
Technically I don't think it's guaranteed that a subsequent lock attempt
will fail. For example, if the SW mutex was somehow held by some other
owner while trying to unlock, by the time we try to lock later on that
owner might have released the SW mutex again.
Obviously if we've managed to lock the SW mutex but fail to unlock
because somebody else was holding it, it means that the other party did
not respect the SW mutex protocol, in which case anything goes.
Anyway, this looks good to me, so:
Acked-by: Thierry Reding <treding@xxxxxxxxxx>
Attachment:
signature.asc
Description: PGP signature