From: sashiko-bot@kernel.org
To: "Nuno Sá via B4 Relay" <devnull+nuno.sa.analog.com@kernel.org>
Cc: linux-hwmon@vger.kernel.org
Subject: Re: [PATCH v11 3/3] gpio: gpio-ltc4283: Add support for the LTC4283 Swap Controller
Date: Wed, 29 Apr 2026 20:33:54 +0000 [thread overview]
Message-ID: <20260429203355.94435C19425@smtp.kernel.org> (raw)
In-Reply-To: <20260429-ltc4283-support-v11-3-27ccde619dad@analog.com>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [Critical] Unconditional NULL pointer dereference in `ltc4283_init_valid_mask`.
- [Medium] Momentary hardware glitch when configuring GPIO as output.
--
commit 7f319a6f25c038e1ae21c4d383a2dec867c1cace
Author: Nuno Sá <nuno.sa@analog.com>
gpio: gpio-ltc4283: Add support for the LTC4283 Swap Controller
This commit adds GPIO support for the LTC4283 Negative Voltage Hot Swap
Controller. It provides a driver for up to 8 configurable pins that can
be used as GPIOs over an auxiliary bus.
> diff --git a/drivers/gpio/gpio-ltc4283.c b/drivers/gpio/gpio-ltc4283.c
> new file mode 100644
> index 000000000000..6609443c5d62
> --- /dev/null
> +++ b/drivers/gpio/gpio-ltc4283.c
[ ... ]
> @@ -0,0 +1,218 @@
> +static int ltc4283_gpio_direction_output(struct gpio_chip *gc, unsigned int off, int val)
> +{
> + struct ltc4283_gpio *st = gpiochip_get_data(gc);
> + int ret;
> +
> + ret = ltc4283_gpio_direction_set(st, off, false);
> + if (ret)
> + return ret;
> +
> + return __ltc4283_gpio_set_value(st, off, val);
> +}
Because ltc4283_gpio_direction_set() and __ltc4283_gpio_set_value() map to
separate regmap updates, could this sequence cause a momentary hardware
glitch?
Setting the direction to output before setting the intended value means the
pin might actively drive its previous state for a short time before the
second transaction completes.
Would it be safer to update the output register to the intended value before
enabling the output driver?
[ ... ]
> +static int ltc4283_init_valid_mask(struct gpio_chip *gc, unsigned long *valid_mask,
> + unsigned int ngpios)
> +{
> + unsigned long *mask = dev_get_platdata(gc->parent);
> +
> + bitmap_copy(valid_mask, mask, ngpios);
> + return 0;
> +}
If the parent device is instantiated without platform data, could this
regression lead to a NULL pointer dereference?
If dev_get_platdata() returns NULL, bitmap_copy() will attempt to copy from
a NULL source pointer:
include/linux/bitmap.h:bitmap_copy() {
...
if (small_const_nbits(nbits))
*dst = *src;
else
memcpy(dst, src, len);
...
}
Should there be a check to ensure mask is not NULL before calling
bitmap_copy()?
[ ... ]
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260429-ltc4283-support-v11-0-27ccde619dad@analog.com?part=3
prev parent reply other threads:[~2026-04-29 20:33 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-29 14:28 [PATCH v11 0/3] hwmon: Add support for the LTC4283 Hot Swap Controller Nuno Sá via B4 Relay
2026-04-29 14:28 ` [PATCH v11 1/3] dt-bindings: hwmon: Document the LTC4283 " Nuno Sá via B4 Relay
2026-04-29 19:24 ` sashiko-bot
2026-04-29 14:28 ` [PATCH v11 2/3] hwmon: ltc4283: Add support for " Nuno Sá via B4 Relay
2026-04-29 20:07 ` sashiko-bot
2026-04-29 14:28 ` [PATCH v11 3/3] gpio: gpio-ltc4283: " Nuno Sá via B4 Relay
2026-04-29 20:33 ` 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=20260429203355.94435C19425@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=devnull+nuno.sa.analog.com@kernel.org \
--cc=linux-hwmon@vger.kernel.org \
--cc=sashiko@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