Linux Hardware Monitor development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Alexis Czezar Torreno" <alexisczezar.torreno@analog.com>
Cc: conor+dt@kernel.org, robh@kernel.org,
	linux-hwmon@vger.kernel.org, devicetree@vger.kernel.org
Subject: Re: [PATCH v4 4/4] hwmon: (pmbus/max20830): add support for max20830c and max20840c
Date: Tue, 28 Jul 2026 03:42:04 +0000	[thread overview]
Message-ID: <20260728034205.3D3E71F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260728-dev-max20830c-v4-4-cec034298535@analog.com>

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [Medium] Missing OF match table entries for new devices breaks module auto-loading.
- [Low] The newly added entries in the i2c_device_id array use positional initializers instead of named initializers, violating I2C subsystem guidelines.
--

--- Patch [4]: [PATCH v4 4/4] hwmon: (pmbus/max20830): add support for max20830c and max20840c ---
commit 4a124678c88f942f9f2f9403e79e6632f0000f9f
Author: Alexis Czezar Torreno <alexisczezar.torreno@analog.com>

hwmon: (pmbus/max20830): add support for max20830c and max20840c
    
Add support for MAX20830C and MAX20840 step-down DC-DC switching
regulator with PMBus interface. MAX20830C is a different packaging
for MAX20830, and MAX20840C supports 40A regulation compared to
MAX20830 that is only 30A.

> diff --git a/drivers/hwmon/pmbus/max20830.c b/drivers/hwmon/pmbus/max20830.c
> index 7c1e94c43ac4e..029733a377123 100644
> --- a/drivers/hwmon/pmbus/max20830.c
> +++ b/drivers/hwmon/pmbus/max20830.c

[ ... ]

> @@ -121,26 +120,28 @@ static int max20830_probe(struct i2c_client *client)
>  		ret = ret - 1;
>  	}
>  
> -	/*
> -	 * MAX20830 IC_DEVICE_ID sends string data "MAX20830\0".
> -	 * Return value should at least be 9 bytes of data.
> -	 */
> +	/* Verify we read the expected number of bytes */
>  	if (ret < MAX20830_IC_DEVICE_ID_LENGTH)
>  		return dev_err_probe(&client->dev, -ENODEV,
> -				     "IC_DEVICE_ID too short: expected at least 9 bytes, got %d\n",
> -				     ret);
> +				     "IC_DEVICE_ID too short: expected %d bytes, got %d\n",
> +				     MAX20830_IC_DEVICE_ID_LENGTH, ret);
> +
> +	/* Null-terminate the string */
> +	buf[ret] = '\0';
>  
> -	/* 9 bytes of data, buf[0]-buf[7] = "MAX20830", buf[8] = '\0' */
> -	buf[MAX20830_IC_DEVICE_ID_LENGTH - 1] = '\0';
> -	if (strncmp(buf, "MAX20830", MAX20830_IC_DEVICE_ID_LENGTH - 1))
> +	/* Verify the device ID matches what we expect */
> +	if ((strcmp(buf, "MAX20830") && strcmp(buf, "MAX20830C") &&
> +	    strcmp(buf, "MAX20840C")))
>  		return dev_err_probe(&client->dev, -ENODEV,
> -				     "Unsupported device: '%s'\n", buf);
> +				     "Unsupported device: '%*pE'\n", ret, buf);
>  
>  	return pmbus_do_probe(client, &data->info);
>  }
>  
>  static const struct i2c_device_id max20830_id[] = {
> -	{"max20830"},
> +	{ "max20830" },
> +	{ "max20830c" },
> +	{ "max20840c" },

[Severity: Low]
This isn't a bug, but does the initialization of this array violate the I2C
subsystem rules?

The I2C subsystem guidelines state that initialized arrays of type
struct i2c_device_id must be declared const and use named initializers
instead of positional ones:

	{ .name = "max20830" },
	{ .name = "max20830c" },
	{ .name = "max20840c" },

[Severity: Medium]
Will this driver fail to auto-load via udev for the new devices when
instantiated via Device Tree?

It seems the new compatibles (e.g., "adi,max20830c" and "adi,max20840c")
were not added to max20830_of_match[] lower down in this file:

static const struct of_device_id max20830_of_match[] = {
	{ .compatible = "adi,max20830" },
	{ }
};

Without updating this array to include the new devices, the kernel won't
emit the correct MODALIAS for the new chips, which breaks module
auto-loading.

>  	{ }
>  };
>  MODULE_DEVICE_TABLE(i2c, max20830_id);

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260728-dev-max20830c-v4-0-cec034298535@analog.com?part=4

  reply	other threads:[~2026-07-28  3:42 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-28  3:32 [PATCH v4 0/4] Add support for MAX20830C and MAX20840C step-down DC-DC switching regulator Alexis Czezar Torreno
2026-07-28  3:32 ` [PATCH v4 1/4] dt-bindings: hwmon: (pmbus/max20830): add VOUT feedback resistor properties and complete examples Alexis Czezar Torreno
2026-07-28  3:39   ` sashiko-bot
2026-07-28  6:41   ` Krzysztof Kozlowski
2026-07-28  3:32 ` [PATCH v4 2/4] hwmon: (pmbus/max20830): add VOUT feedback resistor scaling support Alexis Czezar Torreno
2026-07-28  3:45   ` sashiko-bot
2026-07-28  4:34     ` Guenter Roeck
2026-07-28  5:05       ` Torreno, Alexis Czezar
2026-07-28  3:32 ` [PATCH v4 3/4] dt-bindings: hwmon: (pmbus/max20830): add max20830c and max20840c support Alexis Czezar Torreno
2026-07-28  3:38   ` sashiko-bot
2026-07-28  3:32 ` [PATCH v4 4/4] hwmon: (pmbus/max20830): add support for max20830c and max20840c Alexis Czezar Torreno
2026-07-28  3:42   ` sashiko-bot [this message]
2026-07-28  4:31   ` Guenter Roeck
2026-07-28  5:05     ` Torreno, Alexis Czezar
2026-07-28  5:42       ` Guenter Roeck
2026-07-28  6:58         ` Torreno, Alexis Czezar
2026-07-28 14:25           ` Guenter Roeck

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=20260728034205.3D3E71F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=alexisczezar.torreno@analog.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