Re: [PATCH v7 2/2] gpio: add gpio-line-mux driver

From: Bartosz Golaszewski

Date: Wed Jan 07 2026 - 03:52:56 EST


On Wed, Jan 7, 2026 at 9:40 AM Dan Carpenter <dan.carpenter@xxxxxxxxxx> wrote:
>
> On Sat, Dec 27, 2025 at 06:01:34PM +0000, Jonas Jelonek wrote:
> > +struct gpio_lmux {
> > + struct gpio_chip gc;
> > + struct mux_control *mux;
> > + struct gpio_desc *muxed_gpio;
> > +
> > + u32 num_gpio_mux_states;
> > + unsigned int gpio_mux_states[] __counted_by(num_gpio_mux_states);
> > +};
> > +
> > +static int gpio_lmux_gpio_get(struct gpio_chip *gc, unsigned int offset)
> > +{
> > + struct gpio_lmux *glm = gpiochip_get_data(gc);
> > + int ret;
> > +
> > + if (offset > gc->ngpio)
>
> This is off by one. Should be >=.
>

And it's not even needed, GPIO core handles it. I'll send a patch to remove it.

Bart