From: sashiko-bot@kernel.org
To: "Alex Elder" <elder@riscstar.com>
Cc: bpf@vger.kernel.org
Subject: Re: [PATCH net-next 09/12] gpio: tc956x: add TC956x/QPS615 support
Date: Sat, 02 May 2026 15:56:17 +0000 [thread overview]
Message-ID: <20260502155618.2E65FC19425@smtp.kernel.org> (raw)
In-Reply-To: <20260501155421.3329862-10-elder@riscstar.com>
Thank you for your contribution! Sashiko AI review found 5 potential issue(s) to consider:
- [High] Function signature mismatch for `tc956x_gpio_set` causing build failures.
- [High] Sleeping in atomic context bug on PREEMPT_RT due to `can_sleep = false`.
- [Medium] Uninitialized stack variable used if `regmap_read()` fails.
- [Medium] Ignored `regmap_update_bits()` return value can cause incorrect hardware state.
- [Low] Kconfig depends on a non-existent symbol.
--
commit ff81a192de0fcb35d3c4b8a32cad777cd0bff29e
Author: Alex Elder <elder@riscstar.com>
gpio: tc956x: add TC956x/QPS615 support
This commit adds support for the GPIO controller embedded in the Toshiba
TC956x Ethernet-AVB/TSN bridge. It implements an auxiliary device driver
for the GPIO block using regmap.
> diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig
> --- a/drivers/gpio/Kconfig
> +++ b/drivers/gpio/Kconfig
[ ... ]
> +config GPIO_TC956X
> + tristate "Toshiba TC956X GPIO support"
> + depends on TOSHIBA_TC956X_PCI
Does TOSHIBA_TC956X_PCI exist in the tree at this point? Reference to a
non-existent config symbol causes silent build failures. If it is added
later in the patch series, this temporarily leaves the driver unselectable
and breaks bisectability.
[ ... ]
> diff --git a/drivers/gpio/gpio-tc956x.c b/drivers/gpio/gpio-tc956x.c
> --- /dev/null
> +++ b/drivers/gpio/gpio-tc956x.c
[ ... ]
> +static int tc956x_gpio_get_direction(struct gpio_chip *gc, unsigned int offset)
> +{
> + struct tc956x_gpio *gpio = gpiochip_get_data(gc);
> + u32 reg;
> + u32 val;
> +
> + if (test_bit(offset, gpio->input_only))
> + return GPIO_LINE_DIRECTION_IN;
> +
> + reg = offset < 32 ? GPIO_EN0_OFFSET : GPIO_EN1_OFFSET;
> +
> + regmap_read(gpio->regmap, reg, &val);
If regmap_read() fails, does it leave the stack variable val uninitialized?
Should the return value be checked before evaluating val in the next line?
> + if (val & BIT(offset % 32))
> + return GPIO_LINE_DIRECTION_IN;
> +
> + return GPIO_LINE_DIRECTION_OUT;
> +}
[ ... ]
> +static int tc956x_gpio_direction_output(struct gpio_chip *gc,
> + unsigned int offset, int value)
> +{
> + struct tc956x_gpio *gpio = gpiochip_get_data(gc);
> + u32 vreg;
> + u32 dreg;
> + u32 mask;
[ ... ]
> + /* Set output value first, then direction */
> + regmap_update_bits(gpio->regmap, vreg, mask, value ? mask : 0);
If this first regmap_update_bits() fails, should the function bail out
early? Ignoring the error and proceeding to change the direction to output
anyway could actively drive an unintended logic level onto the pin.
> +
> + return regmap_update_bits(gpio->regmap, dreg, mask, 0);
> +}
> +
> +static int tc956x_gpio_get(struct gpio_chip *gc, unsigned int offset)
> +{
> + u32 reg = offset < 32 ? GPIO_IN0_OFFSET : GPIO_IN1_OFFSET;
> + struct tc956x_gpio *gpio = gpiochip_get_data(gc);
> + u32 val;
> +
> + regmap_read(gpio->regmap, reg, &val);
Similar to tc956x_gpio_get_direction(), does this leave val uninitialized
and return unpredictable states if regmap_read() fails?
> +
> + return val & BIT(offset % 32) ? 1 : 0;
> +}
> +
> +static int tc956x_gpio_set(struct gpio_chip *gc, unsigned int offset, int value)
Does the set function pointer in struct gpio_chip expect a void return
type? Assigning a function returning int could trigger an incompatible
pointer type compiler error or cause Control Flow Integrity panics at
runtime.
> +{
> + u32 reg = offset < 32 ? GPIO_OUT0_OFFSET : GPIO_OUT1_OFFSET;
> + struct tc956x_gpio *gpio = gpiochip_get_data(gc);
> + u32 mask = BIT(offset % 32);
> +
> + return regmap_update_bits(gpio->regmap, reg, mask, value ? mask : 0);
> +}
[ ... ]
> +static int tc956x_gpio_probe(struct auxiliary_device *adev,
> + const struct auxiliary_device_id *id)
> +{
[ ... ]
> + gc->base = -1;
> + gc->ngpio = TC956X_GPIO_COUNT;
> + gc->can_sleep = false;
Is it safe to set can_sleep to false while using a regmap? By default,
MMIO regmaps use spinlock_t for synchronization, which becomes a sleepable
rt_mutex on PREEMPT_RT kernels. Calling these GPIO methods from an atomic
context on PREEMPT_RT could cause a panic.
> +
> + dev_set_drvdata(dev, gpio);
> +
> + return devm_gpiochip_add_data(dev, gc, gpio);
> +}
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260501155421.3329862-1-elder@riscstar.com?part=9
next prev parent reply other threads:[~2026-05-02 15:56 UTC|newest]
Thread overview: 110+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-01 15:54 [PATCH net-next 00/12] net: enable TC956x support Alex Elder
2026-05-01 15:54 ` [PATCH net-next 01/12] net: pcs: pcs-xpcs-regmap: support XPCS memory-mapped MDIO bus via regmap Alex Elder
2026-05-02 15:56 ` sashiko-bot
2026-05-01 15:54 ` [PATCH net-next 02/12] net: pcs: pcs-xpcs: select operating mode for 10G-baseR capable PCS Alex Elder
2026-05-01 16:50 ` Andrew Lunn
2026-05-01 18:07 ` Alex Elder
2026-05-05 15:58 ` Daniel Thompson
2026-05-02 15:56 ` sashiko-bot
2026-05-01 15:54 ` [PATCH net-next 03/12] net: pcs: pcs-xpcs: Preserve BMCR_ANENBLE during link up Alex Elder
2026-05-01 17:06 ` Andrew Lunn
2026-05-06 9:46 ` Daniel Thompson
2026-05-02 15:56 ` sashiko-bot
2026-05-01 15:54 ` [PATCH net-next 04/12] net: stmmac: dma: create a separate dma_device pointer Alex Elder
2026-05-01 17:13 ` Andrew Lunn
2026-05-01 18:06 ` Alex Elder
2026-05-01 20:55 ` Andrew Lunn
2026-05-04 13:36 ` Alex Elder
2026-05-02 15:56 ` sashiko-bot
2026-05-01 15:54 ` [PATCH net-next 05/12] net: stmmac: dwxgmac2: Add multi MSI interrupt mode Alex Elder
2026-05-01 17:21 ` Andrew Lunn
2026-05-01 15:54 ` [PATCH net-next 06/12] net: stmmac: dwxgmac2: Add XGMAC 3.01a support Alex Elder
2026-05-01 15:54 ` [PATCH net-next 07/12] net: stmmac: dwxgmac2: export symbols for XGMAC 3.01a DMA Alex Elder
2026-05-02 15:56 ` sashiko-bot
2026-05-01 15:54 ` [PATCH net-next 08/12] dt-bindings: net: toshiba,tc965x-dwmac: add TC956x Ethernet bridge Alex Elder
2026-05-01 17:38 ` Andrew Lunn
2026-05-03 2:22 ` Alex Elder
2026-05-07 22:17 ` Alex Elder
2026-05-07 23:39 ` Rob Herring
2026-05-02 15:56 ` sashiko-bot
2026-05-07 19:02 ` Rob Herring
2026-05-08 14:36 ` Alex Elder
2026-05-04 11:00 ` Krzysztof Kozlowski
2026-05-04 13:34 ` Alex Elder
2026-05-07 14:47 ` Daniel Thompson
2026-05-07 14:12 ` Bjorn Andersson
2026-05-07 14:19 ` Andrew Lunn
2026-05-07 16:12 ` Bjorn Andersson
2026-05-07 18:37 ` Alex Elder
2026-05-10 2:25 ` Bjorn Andersson
2026-05-07 23:41 ` Rob Herring
2026-05-01 15:54 ` [PATCH net-next 09/12] gpio: tc956x: add TC956x/QPS615 support Alex Elder
2026-05-01 18:36 ` Andrew Lunn
2026-05-03 1:45 ` Alex Elder
2026-05-03 2:48 ` Andrew Lunn
2026-05-07 18:39 ` Alex Elder
2026-05-03 3:05 ` Andrew Lunn
2026-05-06 18:21 ` Alex Elder
2026-05-06 19:43 ` Andrew Lunn
2026-05-06 20:25 ` Alex Elder
2026-05-06 21:43 ` Andrew Lunn
2026-05-06 22:41 ` Alex Elder
2026-05-02 15:56 ` sashiko-bot [this message]
2026-05-03 3:42 ` Julian Braha
2026-05-06 18:51 ` Alex Elder
2026-05-04 12:46 ` Bartosz Golaszewski
2026-05-04 13:07 ` Alex Elder
2026-05-07 12:15 ` Linus Walleij
2026-05-07 12:20 ` Alex Elder
2026-05-01 15:54 ` [PATCH net-next 10/12] net: stmmac: " Alex Elder
2026-05-01 19:04 ` Andrew Lunn
2026-05-07 16:03 ` Daniel Thompson
2026-05-07 16:29 ` Andrew Lunn
2026-05-08 11:25 ` Daniel Thompson
2026-05-08 13:34 ` Andrew Lunn
2026-05-08 15:54 ` Daniel Thompson
2026-05-02 15:56 ` sashiko-bot
2026-05-05 16:38 ` Mohd Ayaan Anwar
2026-05-05 16:46 ` Alex Elder
2026-05-06 2:30 ` Xilin Wu
2026-05-06 17:44 ` Alex Elder
2026-05-07 13:57 ` Xilin Wu
2026-05-07 14:14 ` Andrew Lunn
2026-05-11 15:41 ` Daniel Thompson
2026-05-06 12:59 ` Xilin Wu
2026-05-06 14:19 ` Andrew Lunn
2026-05-06 14:35 ` Xilin Wu
2026-05-06 14:45 ` Andrew Lunn
2026-05-06 15:38 ` Xilin Wu
2026-05-06 15:39 ` Daniel Thompson
2026-05-06 15:44 ` Xilin Wu
2026-05-06 15:56 ` Andrew Lunn
2026-05-06 16:00 ` Xilin Wu
2026-05-06 15:28 ` Daniel Thompson
2026-05-06 19:52 ` Andrew Lunn
2026-05-07 18:44 ` Alex Elder
2026-05-08 13:09 ` Xilin Wu
2026-05-08 13:36 ` Andrew Lunn
2026-05-08 13:41 ` Xilin Wu
2026-05-01 15:54 ` [PATCH net-next 11/12] misc: tc956x_pci: " Alex Elder
2026-05-01 21:07 ` Andrew Lunn
2026-05-03 2:06 ` Alex Elder
2026-05-02 15:56 ` sashiko-bot
2026-05-02 16:45 ` Jakub Kicinski
2026-05-03 2:06 ` Alex Elder
2026-05-03 2:14 ` Jakub Kicinski
2026-05-03 2:23 ` Alex Elder
2026-05-01 15:54 ` [PATCH net-next 12/12] arm64: dts: qcom: qcs6490-rb3gen2: enable TC9564 with a single QCS8081 phy Alex Elder
2026-05-01 21:09 ` Andrew Lunn
2026-05-05 16:25 ` Daniel Thompson
2026-05-05 16:42 ` Mohd Ayaan Anwar
2026-05-05 16:46 ` Alex Elder
2026-05-08 14:03 ` Konrad Dybcio
2026-05-13 12:49 ` Daniel Thompson
2026-05-13 14:35 ` Andrew Lunn
2026-05-14 15:23 ` Daniel Thompson
2026-05-14 16:14 ` Andrew Lunn
2026-05-15 14:42 ` Daniel Thompson
2026-05-02 16:47 ` [PATCH net-next 00/12] net: enable TC956x support Jakub Kicinski
2026-05-03 2:07 ` Alex Elder
2026-05-15 17:59 ` Alex Elder
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=20260502155618.2E65FC19425@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=elder@riscstar.com \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.