* [PATCH] hwmon: (asus-ec-sensors) add missed handle for ENOMEM
@ 2026-07-12 12:51 Eugene Shalygin
2026-07-12 12:58 ` sashiko-bot
0 siblings, 1 reply; 2+ messages in thread
From: Eugene Shalygin @ 2026-07-12 12:51 UTC (permalink / raw)
To: eugene.shalygin
Cc: Guenter Roeck, open list:ASUS EC HARDWARE MONITOR DRIVER,
open list
Add missing return value check in the setup function.
Signed-off-by: Eugene Shalygin <eugene.shalygin@gmail.com>
Fixes: d0ddfd241e57 ("hwmon: (asus-ec-sensors) add driver for ASUS EC")
---
drivers/hwmon/asus-ec-sensors.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/drivers/hwmon/asus-ec-sensors.c b/drivers/hwmon/asus-ec-sensors.c
index eb71e41fd4f4..2be8824e3c62 100644
--- a/drivers/hwmon/asus-ec-sensors.c
+++ b/drivers/hwmon/asus-ec-sensors.c
@@ -1495,9 +1495,10 @@ 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]);
+ if (asus_ec_hwmon_add_chan_info(asus_ec_hwmon_chan, dev,
+ nr_count[type], type,
+ hwmon_attributes[type]))
+ return status;
*ptr_asus_ec_ci++ = asus_ec_hwmon_chan++;
}
--
2.55.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] hwmon: (asus-ec-sensors) add missed handle for ENOMEM
2026-07-12 12:51 [PATCH] hwmon: (asus-ec-sensors) add missed handle for ENOMEM Eugene Shalygin
@ 2026-07-12 12:58 ` sashiko-bot
0 siblings, 0 replies; 2+ messages in thread
From: sashiko-bot @ 2026-07-12 12:58 UTC (permalink / raw)
To: Eugene Shalygin; +Cc: linux-hwmon
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] The newly added error handling incorrectly returns `status` (which evaluates to 0) instead of the actual error code when `asus_ec_hwmon_add_chan_info()` fails.
--
--- Patch [1]: [PATCH] hwmon: (asus-ec-sensors) add missed handle for ENOMEM ---
commit 2fb0c06e28b3b0aad223266de4f30ef04ff0537b
Author: Eugene Shalygin <eugene.shalygin@gmail.com>
hwmon: (asus-ec-sensors) add missed handle for ENOMEM
This commit adds a missing return value check in the setup function
asus_ec_probe() to handle potential memory allocation failures.
> diff --git a/drivers/hwmon/asus-ec-sensors.c b/drivers/hwmon/asus-ec-sensors.c
> index 29a23484cbe7b..dd8c1a3f182e3 100644
> --- a/drivers/hwmon/asus-ec-sensors.c
> +++ b/drivers/hwmon/asus-ec-sensors.c
> @@ -1495,9 +1495,10 @@ 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]);
> + if (asus_ec_hwmon_add_chan_info(asus_ec_hwmon_chan, dev,
> + nr_count[type], type,
> + hwmon_attributes[type]))
> + return status;
[Severity: High]
Does this correctly return the error code? At this point in asus_ec_probe(),
status appears to be 0 from the earlier successful call to setup_lock_data().
Should this capture and return the actual error code from
asus_ec_hwmon_add_chan_info() instead, to avoid returning success (0) while
aborting the probe?
> *ptr_asus_ec_ci++ = asus_ec_hwmon_chan++;
> }
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260712125147.1254339-1-eugene.shalygin@gmail.com?part=1
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-07-12 12:58 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-12 12:51 [PATCH] hwmon: (asus-ec-sensors) add missed handle for ENOMEM Eugene Shalygin
2026-07-12 12:58 ` sashiko-bot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox