From: sashiko-bot@kernel.org
To: "Svyatoslav Ryhel" <clamor95@gmail.com>
Cc: robh@kernel.org, conor+dt@kernel.org, devicetree@vger.kernel.org,
linux-hwmon@vger.kernel.org
Subject: Re: [PATCH v1 3/3] hwmon: (emc1403) Add regulator support
Date: Wed, 03 Jun 2026 14:37:35 +0000 [thread overview]
Message-ID: <20260603143735.8DA891F0089E@smtp.kernel.org> (raw)
In-Reply-To: <20260603141033.111300-4-clamor95@gmail.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [High] The driver fails to probe for `emc1402` and related variants because its enum value is 0, causing it to be mistaken for missing match data.
--
commit 68609b63ba3fac21c7beeccd770258031aea8a06
Author: Svyatoslav Ryhel <clamor95@gmail.com>
hwmon: (emc1403) Add regulator support
This commit adds support for the VCC power supply regulator to the emc1403
sensor driver. It enables the regulator during device probe to ensure the
sensor starts up and functions correctly.
> diff --git a/drivers/hwmon/emc1403.c b/drivers/hwmon/emc1403.c
> index ac84200be71aa..dfdd3982efb7f 100644
> --- a/drivers/hwmon/emc1403.c
> +++ b/drivers/hwmon/emc1403.c
[ ... ]
> @@ -660,6 +661,12 @@ static int emc1403_probe(struct i2c_client *client)
> {
> struct thermal_data *data;
> struct device *hwmon_dev;
> + int ret;
> +
> + ret = devm_regulator_get_enable(&client->dev, "vcc");
> + if (ret)
> + return dev_err_probe(&client->dev, ret,
> + "Failed to enable regulator\n");
>
> data = devm_kzalloc(&client->dev, sizeof(struct thermal_data),
> GFP_KERNEL);
[Severity: High]
This is a pre-existing issue, but does this probe function incorrectly fail
for the emc1402 chip variant?
In drivers/hwmon/emc1403.c, the emc1403_chip enum defines emc1402 as the
first element, giving it a value of 0:
enum emc1403_chip { emc1402, emc1403, emc1404, emc1428 };
When emc1403_probe() executes later in this function, i2c_get_match_data()
returns 0 for the emc1402 chip. The subsequent check:
data->chip = (enum emc1403_chip)i2c_get_match_data(client);
if (!data->chip)
return dev_err_probe(&client->dev, -ENODEV, "Unknown device!\n");
will evaluate to true since data->chip is 0, causing the probe to abort
with -ENODEV. Will this inadvertently break support for the emc1402 sensor
family?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260603141033.111300-1-clamor95@gmail.com?part=3
prev parent reply other threads:[~2026-06-03 14:37 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-03 14:10 [PATCH v1 0/3] hwmon: emc1403: Convert to use OF bindings Svyatoslav Ryhel
2026-06-03 14:10 ` [PATCH v1 1/3] dt-bindings: hwmon: lm90: Document SMSC EMC1402/1403/1404/1428 Svyatoslav Ryhel
2026-06-03 14:23 ` sashiko-bot
2026-06-03 14:10 ` [PATCH v1 2/3] hwmon: (emc1403) Convert to use OF bindings Svyatoslav Ryhel
2026-06-03 14:30 ` sashiko-bot
2026-06-03 14:10 ` [PATCH v1 3/3] hwmon: (emc1403) Add regulator support Svyatoslav Ryhel
2026-06-03 14:37 ` 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=20260603143735.8DA891F0089E@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=clamor95@gmail.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=linux-hwmon@vger.kernel.org \
--cc=robh@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