Hello Javier, On Thu, Jul 10, 2025 at 01:00:41PM +0200, Javier Martinez Canillas wrote: > > > > devm_gpiod_get_optional() returns -ENOENT when the GPIO is not found, > > and that is no error we want to propagage upwards. > > > > Maybe something like this instead: > > if (IS_ERR(st7571->reset) && IS_ERR(st7571->reset) != -ENOENT) > > > > Are you sure about that? As far as I know, that is exactly the > difference between gpiod_get() and gpiod_get_optional() variants. > > From the gpiod_get_optional() function helper kernel-doc [0]: > > /** > * gpiod_get_optional - obtain an optional GPIO for a given GPIO function > * @dev: GPIO consumer, can be NULL for system-global GPIOs > * @con_id: function within the GPIO consumer > * @flags: optional GPIO initialization flags > * > * This is equivalent to gpiod_get(), except that when no GPIO was assigned to > * the requested function it will return NULL. This is convenient for drivers > * that need to handle optional GPIOs. > * > * Returns: > * The GPIO descriptor corresponding to the function @con_id of device > * dev, NULL if no GPIO has been assigned to the requested function, or > * another IS_ERR() code if an error occurred while trying to acquire the > GPIO. > */ > > while the gpiod_get() kernel-doc says the following: > > /** > * gpiod_get - obtain a GPIO for a given GPIO function > * @dev: GPIO consumer, can be NULL for system-global GPIOs > * @con_id: function within the GPIO consumer > * @flags: optional GPIO initialization flags > * > * Returns: > * The GPIO descriptor corresponding to the function @con_id of device > * dev, -ENOENT if no GPIO has been assigned to the requested function, or > * another IS_ERR() code if an error occurred while trying to acquire the > GPIO. > */ >
You are completely righ. Reviewed-by: Marcus Folkesson <marcus.folkes...@gmail.com> Best regards, Marcus Folkesson
signature.asc
Description: PGP signature