From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-ot1-f50.google.com (mail-ot1-f50.google.com [209.85.210.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 66850212FAD for ; Sat, 22 Aug 2026 18:29:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.50 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787423347; cv=none; b=QFwbhkuYsq5KXVAtEcdTDLuz9PT4OJNGNFUeKxrqHwIkRr4K3z4FtKVqN0hbPLi4fTbpZ46tV3IcfuCLb+HtJgebUq/qodgMWKec1/9eD8OqCL9vs696FEi7rh2DEjiu19NJ51iLh+d/NH+bF0Aj34xpfuDswIfOGRZSEFEpm6Y= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787423347; c=relaxed/simple; bh=8eHyr2cLpU40ZlcSQTJudIZpy7jaZmy8Ix31z0SfeYQ=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=q1qy03YYoXWYXRz3ZNg/3ipEYDKUXdlJ/6qAVKwmASqyNgxaE1dleEL3+9EVi9iXe3kgoCQlHIywZVLopNIpn8dmvmvd4wO6kHjYLXyf2Hh60c+t61rc7OfEkacoF8CtvpnZLa0AyTT3f4eKueclPTxP3nJ0Kei6DlzCM7pY0c8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com; spf=pass smtp.mailfrom=baylibre.com; dkim=pass (2048-bit key) header.d=baylibre.com header.i=@baylibre.com header.b=mel/ykWB; arc=none smtp.client-ip=209.85.210.50 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=baylibre.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=baylibre.com header.i=@baylibre.com header.b="mel/ykWB" Received: by mail-ot1-f50.google.com with SMTP id 46e09a7af769-7e9eaf04bfaso1050672a34.1 for ; Sat, 22 Aug 2026 11:29:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre.com; s=google; t=1787423344; x=1788028144; darn=vger.kernel.org; h=content-transfer-encoding:content-type:in-reply-to:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:from:to:cc:subject:date:message-id:reply-to :content-type; bh=rZDUDDqQBTf2cGZ/TzEkaySKSdO2kJb56NJwzuqq3UQ=; b=mel/ykWBLp1ZIETZLywL7eFDfF/9pP9sKMFB2mWLjMcpy1HaprCvf++Lwedu1oGXKS Wzz4tXPTy2zF/Dkip8GzSaJsf8VezjBylKiV94d6TM88Sei0prDH1A0Ee4RYxdYUVpiW zSow/erJ00IvTocJB31oKX0vQFE86D4dIq/cAJHNmpxIJ3hicA7AWi+cCRq6ev808C1z pWhb4Ugu9BeOFAqiuhATaTz6b4DcWZiFuLQzMpUw9F975UGsfJAlQPMzg7rfeSSW8o13 ncRvNxWaYgylvZXK6lNiKmLGeOBcIEe/8Vy6HSV50jWgyhFnyUT+TtJnpYdQYtjFlo2e 6zEA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1787423344; x=1788028144; h=content-transfer-encoding:content-type:in-reply-to:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=rZDUDDqQBTf2cGZ/TzEkaySKSdO2kJb56NJwzuqq3UQ=; b=TU7jTCrCdo6j4ssvpUSA86Kj+1u3WStPALdFZpCOaUZl2/Ug/e111vWG9L3wTBkK3y NRgw5a6EoXTDEIvIxiuooQb+jQkeLdevsieqyuJxYqSt3Z3/PmqIHVL7ymf4w4MlqISi W5nlKj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ca4a with SMTP id 006d021491bc7-6b16b2293eemr5582477eaf.11.1787423344245; Sat, 22 Aug 2026 11:29:04 -0700 (PDT) Received: from ?IPV6:2600:8803:e7e4:500:e0ca:316a:4629:d835? ([2600:8803:e7e4:500:e0ca:316a:4629:d835]) by smtp.gmail.com with ESMTPSA id 006d021491bc7-6b13cbd4f12sm12426234eaf.6.2026.08.22.11.29.03 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 22 Aug 2026 11:29:03 -0700 (PDT) Message-ID: <1711ef3d-727a-4898-9aa1-887369ddbc06@baylibre.com> Date: Sat, 22 Aug 2026 13:29:02 -0500 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] iio: temperature: tmp117: fix calibbias cache update on I2C write failure To: Salah Triki , Puranjay Mohan , Jonathan Cameron , =?UTF-8?Q?Nuno_S=C3=A1?= , Andy Shevchenko Cc: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org References: <20260822004929.13643-1-salah.triki@gmail.com> Content-Language: en-US From: David Lechner In-Reply-To: <20260822004929.13643-1-salah.triki@gmail.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 8/21/26 7:49 PM, Salah Triki wrote: > The calibbias cache (data->calibbias) was updated before the I2C > write to TMP117_REG_TEMP_OFFSET was known to succeed. If the write > failed, the function correctly returned an error, but the driver's > internal cache had already been updated to the new value. > > This causes the cache and the actual hardware register to go out of > sync: a subsequent write of the same value would be silently > skipped by the early "if (off == data->calibbias) return 0;" check, > since the cache matches even though the register was never > successfully updated. > > Update data->calibbias only after confirming the I2C write > succeeded, so the cache always reflects the actual state of the > device. > For fixes, it is always useful to know how you found the problem. I'm guessing code inspection here. > Fixes: df041e737a38 ("iio: temperature: add driver support for ti tmp117") > Signed-off-by: Salah Triki > ---