Oops I missed one thing: On Wed, Jun 12, 2019 at 6:50 AM Harish Jenny K N <harish_kandiga@xxxxxxxxxx> wrote: > +struct gpio_inverter { > + struct gpio_chip gpiochip; > + int count; > + struct gpio_desc *gpios[0]; No [0] as Geert points out and: > + size = sizeof(*virt) + count * sizeof(struct gpio_desc *); > + virt = devm_kzalloc(dev, size, GFP_KERNEL); > + if (!virt) > + return -ENOMEM; Use this: inv = devm_kzalloc(dev, struct_size(inv, gpios, count), GFP_KERNEL); We use struct_size() for dynamic structs with headroom in the tail. Yours, Linus Walleij