On Mon, Oct 1, 2018 at 3:36 PM Ricardo Ribalda Delgado <ricardo.ribalda@xxxxxxxxx> wrote: > On Mon, Oct 1, 2018 at 1:54 PM Linus Walleij <linus.walleij@xxxxxxxxxx> wrote: > > On Fri, Sep 28, 2018 at 9:30 PM Ricardo Ribalda Delgado > > <ricardo.ribalda@xxxxxxxxx> wrote: > > > > > How do we proceed from here? Can you fix your driver somehow to > > > init the valid mask before enabling the gpio? > > > > Just include a hunk to the qcom driver reordering this call > > at the same time. No need to make it separate patches, > > it need to be tested together anyways. > > > > I guess just switch the order of these two: > > > > ret = gpiochip_add_data(&pctrl->chip, pctrl); > > if (ret) { > > dev_err(pctrl->dev, "Failed register gpiochip\n"); > > return ret; > > } > > > > ret = msm_gpio_init_valid_mask(chip, pctrl); > > if (ret) { > > dev_err(pctrl->dev, "Failed to setup irq valid bits\n"); > > gpiochip_remove(&pctrl->chip); > > return ret; > > } > > > > the problem is that valid_mask is not a long/integer, is a struct that > needs to be malloced, and is malloc at gpiochip_add_data :( I don't get it, but maybe I'm not smart enough. gpiochip_add_data() doesn't allocate anything, it just adds a already allocated (or static!) gpio_chip to the gpiolib subsystem. In fact I think it is wrong to set up the mask after calling gpiolob_add_data(), because of exactly the type of problem you're seeing. Don't get confused by the &pctrl->chip vs just chip variables, it's just some sloppiness. Yours, Linus Walleij