On Thu, Oct 12, 2017 at 11:08 PM, Dan Carpenter <dan.carpenter@xxxxxxxxxx> wrote: > drivers/gpio/gpiolib.c > 2345 int gpiod_direction_output(struct gpio_desc *desc, int value) > 2346 { > 2347 struct gpio_chip *gc = desc->gdev->chip; > 2348 int ret; > 2349 > 2350 VALIDATE_DESC(desc); > > I'm not a huge fan of the VALIDATE_DESC() macro because it has hidden > returns in it... It was the best I could come up with. It's either this macro, or duplicate the same code all over the place which would be a mess. This is the lesser evil IMO, if you have better ideas, .... share them. :) (Duplicating the descriptor check at every site is not a good idea. Static inlines cannot be used, because we need to return if the descriptor is invalid. You get the picture...) > But actually it's the earlier desc->gdev->chip > dereference which is wrong. We should probably move that below the > checks for NULL. True. I bet there is already a patch in my inbox ;) Yours, Linus Walleij -- To unsubscribe from this list: send the line "unsubscribe linux-gpio" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html