From: sashiko-bot@kernel.org
To: hpp.iscas <hppiscas@163.com>
Cc: linux-hwmon@vger.kernel.org
Subject: Re: [PATCH] hwmon: (max6639) Publish the OF module alias
Date: Sat, 05 Sep 2026 13:48:39 +0000 [thread overview]
Message-ID: <20260905134840.424E51F00A3D@smtp.kernel.org> (raw)
In-Reply-To: <20260905133643.65365-1-hppiscas@163.com>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
Pre-existing issues:
- [Critical] Missing i2c_set_clientdata() in probe causes a NULL pointer dereference in PM suspend/resume callbacks.
- [High] Unbalanced regulator disable if I2C access fails during suspend.
--
commit e5868671fda98c3e539843bf646808d132b90df7
Author: hpp.iscas <hppiscas@163.com>
hwmon: (max6639) Publish the OF module alias
This patch publishes the max6639_of_match table as the OF device ID
module table. This ensures the correct OF modalias is emitted by the I2C
core for Device Tree clients, complementing the legacy I2C detection.
> diff --git a/drivers/hwmon/max6639.c b/drivers/hwmon/max6639.c
> index dd5f4b3b128da..bf9236151be19 100644
> --- a/drivers/hwmon/max6639.c
> +++ b/drivers/hwmon/max6639.c
> @@ -790,6 +790,7 @@ static const struct of_device_id max6639_of_match[] = {
> { .compatible = "maxim,max6639", },
> { },
> };
> +MODULE_DEVICE_TABLE(of, max6639_of_match);
>
> static struct i2c_driver max6639_driver = {
> .class = I2C_CLASS_HWMON,
[Severity: Critical]
This is a pre-existing issue, but does max6639_probe() forget to set the
driver data for the parent I2C device?
max6639_probe() registers the hwmon device, which binds the driver data to
the new hwmon device:
hwmon_dev = devm_hwmon_device_register_with_info(dev, client->name,
data, &max6639_chip_info,
NULL);
However, there is no corresponding call to i2c_set_clientdata() or
dev_set_drvdata() for the parent I2C device.
When the PM core calls max6639_suspend() or max6639_resume(), it passes the
parent I2C device:
static int max6639_suspend(struct device *dev)
{
struct max6639_data *data = dev_get_drvdata(dev);
if (data->reg)
Won't dev_get_drvdata(dev) return NULL here, causing an immediate NULL
pointer dereference upon system suspend or resume?
[Severity: High]
This isn't a bug introduced by this patch, but could this lead to an
unbalanced regulator disable if the I2C access fails during suspend?
In max6639_suspend():
if (data->reg)
regulator_disable(data->reg);
return regmap_write_bits(data->regmap, MAX6639_REG_GCONFIG,
MAX6639_GCONFIG_STANDBY,
MAX6639_GCONFIG_STANDBY);
If regmap_write_bits() fails, the error is returned directly but the
regulator remains disabled.
The PM core will abort the suspend transition for this device and it will
conceptually remain active, potentially leading to overheating as the fan
is off. Later, when the driver is unbound, devres will run
max6639_regulator_disable(), which could result in a negative enable count
in the regulator core.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260905133643.65365-1-hppiscas@163.com?part=1
prev parent reply other threads:[~2026-09-05 13:48 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-05 13:36 [PATCH] hwmon: (max6639) Publish the OF module alias hpp.iscas
2026-09-05 13:48 ` sashiko-bot [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260905134840.424E51F00A3D@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=hppiscas@163.com \
--cc=linux-hwmon@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox