hwmon: (asus-ec-sensors) add missed handle for ENOMEM
Subsystems (2)
Eugene Shalygin
maintainerPATCH 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 | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/hwmon/asus-ec-sensors.c +4 -3
@@ -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++; }
Signature · 1 line
2.55.0
[email protected]
AI reviewThank 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…
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 <[email protected]>
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.
Quoted 5 lines
drivers/hwmon/asus-ec-sensors.c +0
-0
drivers/hwmon/asus-ec-sensors.c static int asus_ec_probe(struct platform_device *pdev) · line 1501
Quoted 10 lines
drivers/hwmon/asus-ec-sensors.c +4
-3@@ -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?
Quoted 2 lines
drivers/hwmon/asus-ec-sensors.c +0
-0*ptr_asus_ec_ci++ = asus_ec_hwmon_chan++; }
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1