hwmon: (asus-ec-sensors) add missed handle for ENOMEM
Subsystems (2)
Eugene Shalygin
maintainerv2 cover hwmon: (asus-ec-sensors) add missed handle for ENOMEM
v2: fix silly mistake when 0 would be returned from the setup function in case of error in asus_ec_hwmon_add_chan_info(), making the module load in partially initialized state.
Eugene Shalygin (1):
hwmon: (asus-ec-sensors) add missed handle for ENOMEM
drivers/hwmon/asus-ec-sensors.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
Signature · 1 line
2.55.0
Eugene Shalygin
maintainerPATCH v2 1/1 hwmon: (asus-ec-sensors) add missed handle for ENOMEM
Add missing return value check in the setup function.
--- drivers/hwmon/asus-ec-sensors.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/hwmon/asus-ec-sensors.c +5 -3
@@ -1495,9 +1495,11 @@ static int asus_ec_probe(struct platform_device *pdev)if (!nr_count[type])continue ; -asus_ec_hwmon_add_chan_info (asus_ec_hwmon_chan, dev, - nr_count[type], type, - hwmon_attributes[type]); + status =asus_ec_hwmon_add_chan_info (asus_ec_hwmon_chan, dev, + nr_count[type], type, + hwmon_attributes[type]); +if (status) +return status; *ptr_asus_ec_ci++ = asus_ec_hwmon_chan++; }
Signature · 1 line
2.55.0
[email protected]
AI reviewThank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [High] Spurious out-of-bank EC register reads due to incorrect filtering condition in asus_ec_block_read(). --
--- Patch [1]: [PATCH v2 1/1] hwmon: (asus-ec-sensors) add missed handle for ENOMEM --- commit 6c544c8bc415253dbbfc446299b7748bcc5d2a83
Author: Eugene Shalygin <[email protected]>
hwmon: (asus-ec-sensors) add missed handle for ENOMEM
Add missing return value check in the setup function.
drivers/hwmon/asus-ec-sensors.c
Quoted 4 lines
drivers/hwmon/asus-ec-sensors.c +0
-0
[ ... ]
[Severity: High]
This isn't a bug introduced by this patch, but I noticed a potential issue in asus_ec_block_read() while reviewing this driver.
drivers/hwmon/asus-ec-sensors.c:asus_ec_block_read() { [ ... ]
for (ibank = 0; ibank < ec->nr_banks; ibank++) {
if (bank != ec->banks[ibank]) {
bank = ec->banks[ibank];
[ ... ]
}
for (ireg = 0; ireg < ec->nr_registers; ireg++) {
reg_bank = register_bank(ec->registers[ireg]);
if (reg_bank < bank) {
continue;
}
ec_read(register_index(ec->registers[ireg]),
ec->read_buffer + ireg);
}
}[ ... ]
}
Since the inner loop only skips registers from previously read banks (reg_bank < bank), does this code mistakenly read registers intended for future banks (where reg_bank > bank) while the hardware EC is still switched to the current bank?
For example, if the hardware EC is switched to bank 0, would it incorrectly read registers intended for bank 1, 2, etc., from the bank 0 hardware interface?
Could reading arbitrary Embedded Controller registers without being in the correct bank trigger clear-on-read side effects, disrupt state machines, or lock up the EC?
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
Eugene Shalygin
maintainerQuoted 4 lines · On Sun, 12 Jul 2026 at 15:12, <[email protected]> wrote:
[Severity: High]
This isn't a bug introduced by this patch, but I noticed a potential issue inasus_ec_block_read()while reviewing this driver.
It went full circle; the fix for that is submitted as "hwmon:
(asus-ec-sensors) fix looping over banks while reading from EC".
Eugene