Devicetree
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Svyatoslav Ryhel" <clamor95@gmail.com>
Cc: devicetree@vger.kernel.org, robh@kernel.org, conor+dt@kernel.org,
	linux-hwmon@vger.kernel.org
Subject: Re: [PATCH v1 2/3] hwmon: (emc1403) Convert to use OF bindings
Date: Wed, 03 Jun 2026 14:30:08 +0000	[thread overview]
Message-ID: <20260603143009.38F961F00893@smtp.kernel.org> (raw)
In-Reply-To: <20260603141033.111300-3-clamor95@gmail.com>

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] The driver probe unconditionally fails for `emc1402` devices because its chip enum value evaluates to 0, which triggers an erroneous error path.
- [Low] Directly casting `const void *` to `enum emc1403_chip` causes a `-Wpointer-to-int-cast` compiler warning on 64-bit architectures.
--

commit 8e14b2d237bb423a526fb43282f03dadf7dbb7dc
Author: Jonas Schwöbel <jonasschwoebel@yahoo.de>

hwmon: (emc1403) Convert to use OF bindings

This commit adds an OF match compatible table. This allows the driver to be 
used with Device Trees.

> diff --git a/drivers/hwmon/emc1403.c b/drivers/hwmon/emc1403.c
> --- a/drivers/hwmon/emc1403.c
> +++ b/drivers/hwmon/emc1403.c
[ ... ]
> @@ -659,14 +660,16 @@ static int emc1403_probe(struct i2c_client *client)
[ ... ]
> -	data->chip = id->driver_data;
> +	data->chip = (enum emc1403_chip)i2c_get_match_data(client);

[Severity: Low]
Does directly casting the pointer returned by i2c_get_match_data() to a 
32-bit enum cause a pointer-to-int-cast compiler warning on 64-bit 
architectures? Would it be safer to cast it to an intermediate 
pointer-sized integer first?

> +	if (!data->chip)

[Severity: High]
Since enum emc1403_chip defines emc1402 as 0, will this check evaluate 
to true for devices compatible with emc1402? It appears this might cause 
the probe function to erroneously return -ENODEV and break initialization 
for chips mapping to emc1402.

> +		return dev_err_probe(&client->dev, -ENODEV, "Unknown device!\n");
> +
>  	data->regmap = devm_regmap_init_i2c(client, &emc1403_regmap_config);
[ ... ]

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260603141033.111300-1-clamor95@gmail.com?part=2

  reply	other threads:[~2026-06-03 14:30 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 [this message]
2026-06-03 14:10 ` [PATCH v1 3/3] hwmon: (emc1403) Add regulator support Svyatoslav Ryhel
2026-06-03 14:37   ` sashiko-bot

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=20260603143009.38F961F00893@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