On Wed, 2024-10-02 at 04:09 -0700, Dmitry Torokhov wrote: > Hi Nuno, > > On Wed, Oct 02, 2024 at 12:51:50PM +0200, Nuno Sa via B4 Relay wrote: > > @@ -455,8 +457,16 @@ static int adp5588_gpio_add(struct adp5588_kpad *kpad) > > for (i = 0; i <= ADP5588_BANK(ADP5588_MAXGPIO); i++) { > > kpad->dat_out[i] = adp5588_read(kpad->client, > > GPIO_DAT_OUT1 + i); > > + if (kpad->dat_out[i] < 0) > > + return kpad->dat_out[i]; > > + > > kpad->dir[i] = adp5588_read(kpad->client, GPIO_DIR1 + i); > > + if (kpad->dir[i] < 0) > > + return kpad->dir[i]; > > + > > kpad->pull_dis[i] = adp5588_read(kpad->client, GPIO_PULL1 + i); > > + if (kpad->pull_dis[i] < 0) > > + return kpad->pull_dis[i]; > > > Unfortunately all these are u8 so they will never be negative. You need > to do the adp5588_read() refactor first and then (or maybe together) add > error checking. > Ahh crap... Completely missed that. Yeah, will see what looks better... Thanks for catching this. BTW, this is also wrong in the adp5589 series. - Nuno Sá