lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20260110172003.13969-2-tinsaetadesse2015@gmail.com>
Date: Sat, 10 Jan 2026 20:19:24 +0300
From: Tinsae Tadesse <tinsaetadesse2015@...il.com>
To: linux@...ck-us.net
Cc: Tinsae Tadesse <tinsaetadesse2015@...il.com>,
	linux-hwmon@...r.kernel.org,
	linux-kernel@...r.kernel.org
Subject: [PATCH 2/3] hwmon: spd5118: Retry temperature reads after temporary I2C errors

After suspend/resume, the SPD5118 hub or the underlying I2C adapter
may not be immediately available, causing register reads to fail.

Attempt a single regcache re-synchronization and retry the read to
allow recovery.

Signed-off-by: Tinsae Tadesse <tinsaetadesse2015@...il.com>
---
 drivers/hwmon/spd5118.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/drivers/hwmon/spd5118.c b/drivers/hwmon/spd5118.c
index ec9f14f6e0df..63f798991363 100644
--- a/drivers/hwmon/spd5118.c
+++ b/drivers/hwmon/spd5118.c
@@ -101,6 +101,7 @@ static int spd5118_read_temp(struct regmap *regmap, u32 attr, long *val)
 	int reg, err;
 	u8 regval[2];
 	u16 temp;
+	bool retried = false;
 
 	switch (attr) {
 	case hwmon_temp_input:
@@ -122,9 +123,17 @@ static int spd5118_read_temp(struct regmap *regmap, u32 attr, long *val)
 		return -EOPNOTSUPP;
 	}
 
+retry:
 	err = regmap_bulk_read(regmap, reg, regval, 2);
-	if (err)
+	if (err) {
+		if (!retried && (err == -ENXIO || err == -EIO)) {
+			retried = true;
+			regcache_mark_dirty(regmap);
+			if (!regcache_sync(regmap))
+				goto retry;
+		}
 		return err;
+	}
 
 	temp = (regval[1] << 8) | regval[0];
 
-- 
2.47.3


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ