From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f177.google.com (mail-pl1-f177.google.com [209.85.214.177]) (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 D3F6517C211 for ; Tue, 28 Jul 2026 00:54:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.177 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785200065; cv=none; b=ecJFF473DSM5vWULPX6cGcRsr4yc+xhFVk9+tPPDBJxmRNSf27/PpKmwN4QKfPN3WhatetQdx/mPXz8QX1VVZq4/sHrCTC/ZbWRHH5I194VBXFr54TjkXe44CYQIPQD8BfUoS5F4KToPdg2f6MU4vGtERHuTQCGD9pfokod46Oc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785200065; c=relaxed/simple; bh=r0vJ8VfV2TFecW2t6wzJl2TjGR6rrvcgiKuOD5aKdec=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=uFTtzyg/BpOsXQy6+Ubi8zHBGQgVf6O0vj2tD/lb7iEkJd8afrSjyAjodXOC89aF4jx0i6UPEp9rCUw+Gvg9zu6kVYAAQcdbliIiZH/OKyRq2cVD0hHmus6zTSAgel/Om45gWrS60tjpngONHeHMQ9hTm2vJeVtly6T0v2wIH2Q= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=roeck-us.net; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=oiznIei5; arc=none smtp.client-ip=209.85.214.177 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=roeck-us.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="oiznIei5" Received: by mail-pl1-f177.google.com with SMTP id d9443c01a7336-2cf6d65d8a7so48810645ad.0 for ; Mon, 27 Jul 2026 17:54:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1785200063; x=1785804863; darn=vger.kernel.org; h=in-reply-to:content-disposition:content-type:mime-version :references:message-id:subject:cc:to:from:date:sender:from:to:cc :subject:date:message-id:reply-to:content-type; bh=+hUnMDzHN4xrSunfsprxWjWlx1Z/uBNyd7/o2VtlKrQ=; b=oiznIei5zS1nnVpc9YBiNX2hqzI+5NOvvk74Tez2q+PINDtJoYApwPZmA7JA2Sq7f2 GWGsV/jLAub8b2I30D61L5ff0hJ0P9ljsiXPv0cOLbxlGUi5ni64eCGotHxIAYmchvDJ J/PV3PCINN94gn5Dx9VIAmogDs2NTEEqA3oxEISWIRn056bs7kepgegbB76QYZGHRIlH JTjvlYQt5WfEbw01LMXdxcAZqTtJFee8Pof3K3F54eeGkv9jqho2qaly8vIugKKegjxI IYIoQXMNBkBIOk7Ol9G2l34VNtFZKXkhk8xNSkF9H2nwZJzR15GFv4Srg7axf6FW9vlm Z4fw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785200063; x=1785804863; h=in-reply-to:content-disposition:content-type:mime-version :references:message-id:subject:cc:to:from:date:sender:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=+hUnMDzHN4xrSunfsprxWjWlx1Z/uBNyd7/o2VtlKrQ=; b=DI/Rh5roQ5dna3T1LiKRU3BCVQgNugsdi6tzFEFnA+FGoXOFiQU+5CWWu4Md88GYnA 9aXK0ays6dZkqkMoztcjfhL8XiJi4iRHBXRT96cYoVjutyWC+LeyhQVBsEEZLVM9b9UR nOcf8IU52nVF1GrXuDDpbAOr4xb7yUC5M8BqIlxWEFAr1yoWLgfBFm3t4MbWx2lDC8U5 wgwfoJRRk0n2SqfHe1Rin3IhtIYyPdV+niVMmbNuv37TRKOdC7HSctG15WE+x65r10PN FQa5rJ853JF0UQAb9t4Sej3+VqFduk+x4VFGiGRkjhtcU8GZ7thZSw30m01EoKhJTOQc 1Ibg== X-Forwarded-Encrypted: i=1; AHgh+RqWsJ140uqNjaFNUaUtleDdYbbHQ4do0D5QyTg0MUCGomx5PZdsWA2b14nhEJRsEaJuxTY4CxGHzzPuJWU=@vger.kernel.org X-Gm-Message-State: AOJu0Ywju/rG777JZGUct5OyMZyThoxjhHqtAKI9sKHFlQoXFRxWxXSv GHbrHkntvj5gFwBMxmS8RvhL/Et1Q62SbXFPeWC5OgKLzwuNvthhlyMF X-Gm-Gg: AR+sD11qj4X/koelRuNw+LJPkTOu19eVU77ErSC/wBZtkVA2ROJhqNbhUwKBsV1ABPL dA1GHfNKUZUagBlStGg61zTHYL6jv6hm+WaChETKFPJwb0rlDNKA5kRkmWBnYm8xNmxl9pHH9Ya 6x+eR3lZ6jfluagzgWpY0ydCZqDj1ZGIND+PUlt6kFn7L3ZhK9kg1eXKhbKj37lEFxpKpEnU6ve jwAo0yVUjunK5p1X3lYvvuslbDqYqgW5K4WRvvFCRAONH6Jr9Rwaz9di1qjTaLShBNkcEgPS0Ww WXZjeT6+Yd7Xlmg4XdWz5dnqPI8VdrIrefKeffS+VVb9L1HP2/5TUp0RjqxIe6vD5/HwEED1nhJ aLMVR1xocXxzn/KUFH1ZUo1ZPMhAaqQsn/++dPckJ1n2MYyaVEMU19CiKljc0ZP8W5i1A1o3bwG hOieVRqfjOqTzDaYY= X-Received: by 2002:a17:902:e945:b0:2cc:ee78:3236 with SMTP id d9443c01a7336-2d015f38fe1mr1738055ad.33.1785200063153; Mon, 27 Jul 2026 17:54:23 -0700 (PDT) Received: from server.roeck-us.net ([2600:1700:e321:62f0:da43:aeff:fecc:bfd5]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2cfde59b451sm43285155ad.13.2026.07.27.17.54.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Jul 2026 17:54:22 -0700 (PDT) Sender: Guenter Roeck Date: Mon, 27 Jul 2026 17:54:22 -0700 From: Guenter Roeck To: Luiz Angelo Daros de Luca Cc: Chris Packham , Andrew Morton , "Darrick J. Wong" , "Mark M. Hoffman" , linux-hwmon@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [hwmon PATCH v2 2/8] hwmon: (adt7470) Fix cache updated before hardware write on I2C error Message-ID: <3a15c09c-0e1f-4752-8df2-fa74752b0ebf@roeck-us.net> References: <20260727-adt7470_fixes-v2-0-598e38a46ba6@gmail.com> <20260727-adt7470_fixes-v2-2-598e38a46ba6@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20260727-adt7470_fixes-v2-2-598e38a46ba6@gmail.com> On Mon, Jul 27, 2026 at 09:22:18PM -0300, Luiz Angelo Daros de Luca wrote: > adt7470_temp_write() and adt7470_pwm_write() update the driver's > cached values (temp_min, temp_max, pwm_input, pwm_enable) before issuing > the corresponding regmap_write(), and never check whether the write > succeeded before committing that update. If the I2C transaction fails, > the function correctly propagates the error to the caller, but the cache > silently keeps the new value, which was never actually applied to the > hardware. Subsequent reads then report a value that does not match the > device state. > > Reorder both write paths to update the cache only after a successful > regmap_write(), so the cache always reflects what was actually > written to the hardware. > > Fixes: ef67959c4253 ("hwmon: (adt7470) Convert to use regmap") > Signed-off-by: Luiz Angelo Daros de Luca Applied. Thanks, Guenter