On Thu, Feb 8, 2024 at 6:39 PM Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx> wrote: > > On Thu, Feb 08, 2024 at 10:59:15AM +0100, Bartosz Golaszewski wrote: > > From: Bartosz Golaszewski <bartosz.golaszewski@xxxxxxxxxx> > > > > We don't need to check the gdev pointer in struct gpio_desc - it's > > always assigned and never cleared. It's also pointless to check > > gdev->chip before we actually serialize access to it. > > ... > > > struct gpio_chip *gpiod_to_chip(const struct gpio_desc *desc) > > { > > - if (!desc || !desc->gdev) > > + if (!desc) > > Wondering if it makes sense to align with the below and use IS_ERR_OR_NULL() check. > Nah, it's not supposed to be used with optional GPIOs anyway as it's not a consumer facing API. > > return NULL; > > return desc->gdev->chip; > > ... > > > - if (!desc || IS_ERR(desc) || !desc->gdev || !desc->gdev->chip) > > + if (!desc || IS_ERR(desc)) > > IS_ERR_OR_NULL() > Ah, good point. It's a small nit though so I'll fix it when applying barring some major objections for the rest. Bart > > return -EINVAL; > > > > gc = desc->gdev->chip; > > -- > With Best Regards, > Andy Shevchenko > >