Re: [PATCH v2 2/2] media: uvcvideo: Use dev_err_probe for devm_gpiod_get_optional

From: Doug Anderson
Date: Fri Mar 07 2025 - 11:10:57 EST


Hi,

On Mon, Mar 3, 2025 at 11:07 AM Ricardo Ribalda <ribalda@xxxxxxxxxxxx> wrote:
>
> Use the dev_err_probe() helper for devm_gpiod_get_optional(), like we do
> with gpiod_to_irq()
>
> That eventually calls device_set_deferred_probe_reason() which can be
> helpful for tracking down problems.
>
> Suggested-by: Doug Anderson <dianders@xxxxxxxxxxxx>
> Signed-off-by: Ricardo Ribalda <ribalda@xxxxxxxxxxxx>
> ---
> drivers/media/usb/uvc/uvc_driver.c | 9 +++++++--
> 1 file changed, 7 insertions(+), 2 deletions(-)

Reviewed-by: Douglas Anderson <dianders@xxxxxxxxxxxx>

NOTE: If it were up to me, I would have also changed the caller of
uvc_gpio_parse() to no longer print an error message in the case of
errors. After your patch here all causes of errors in uvc_gpio_parse()
will have already printed something, so the extra print is not
terribly useful and just clutters the code and logs. That being said,
it's not a huge deal and I'm happy to let owners of this code indicate
what they like. :-)

-Doug