hwmon: (mp5990) Publish the OF module aliases
PATCH 1/1 hwmon: (mp5990) Publish the OF module aliases
MP5990 and MP5998 Device Tree clients are matched through mp5990_of_match. Only the I2C ID table is currently published, although Device Tree clients emit OF modalias events.
Publish the existing OF table without changing PMBus operations or per-chip match data.
--- drivers/hwmon/pmbus/mp5990.c | 1 + 1 file changed, 1 insertion(+)
drivers/hwmon/pmbus/mp5990.c +1 -0
@@ -213,6 +213,7 @@ static const struct of_device_id mp5990_of_match[] = { { .compatible = "mps,mp5998", .data = (void *)mp5998 }, {} }; +MODULE_DEVICE_TABLE (of, mp5990_of_match);static struct i2c_driver mp5990_driver = { .driver = {
[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] Unsafe fallback matching logic causes a NULL pointer dereference when probed via ACPI PRP0001. --
commit 8c03c546eec5de58e0c8478c39f38b64125e7713
Author: hpp.iscas <[email protected]>
hwmon: (mp5990) Publish the OF module aliases
MP5990 and MP5998 Device Tree clients are matched through mp5990_of_match. Only the I2C ID table is currently published, although Device Tree clients emit OF modalias events.
drivers/hwmon/pmbus/mp5990.c static const struct of_device_id mp5990_of_match[] = { · line 216
Quoted 9 lines
drivers/hwmon/pmbus/mp5990.c +1
-0@@ -213,6 +213,7 @@ static const struct of_device_id mp5990_of_match[] = { { .compatible = "mps,mp5998", .data = (void *)mp5998 }, {} }; +MODULE_DEVICE_TABLE (of, mp5990_of_match);
[Severity: High]
This isn't a bug introduced by this patch, but I noticed a potential NULL pointer dereference in mp5990_probe():
drivers/hwmon/pmbus/mp5990.c:mp5990_probe() {
...
if (client->dev.of_node)
chip = (uintptr_t)of_device_get_match_data(&client->dev);
else
chip = i2c_match_id(mp5990_id, client)->driver_data;
...
}If the driver is probed via an ACPI PRP0001 node, client->dev.of_node is NULL. The probe function will fall back to the else branch and call i2c_match_id().
Because the client's name is derived from ACPI (e.g., 'PRP0001:00') and is absent from mp5990_id, i2c_match_id() will return NULL.
Could the unconditional dereference of ->driver_data cause a kernel panic in this scenario?
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1