Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

media: uvcvideo: Use dev_err_probe for devm_gpiod_get_optional

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.

Now that all the error paths in uvc_gpio_parse have dev_err_probe, we
can remove the error message in uvc_probe.

Suggested-by: Doug Anderson <dianders@chromium.org>
Reviewed-by: Douglas Anderson <dianders@chromium.org>
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Message-ID: <20250313-uvc-eprobedefer-v3-2-a1d312708eef@chromium.org>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>

authored by

Ricardo Ribalda and committed by
Hans Verkuil
3328eb4d 387e8939

+8 -5
+8 -5
drivers/media/usb/uvc/uvc_driver.c
··· 1299 1299 1300 1300 gpio_privacy = devm_gpiod_get_optional(&dev->intf->dev, "privacy", 1301 1301 GPIOD_IN); 1302 - if (IS_ERR_OR_NULL(gpio_privacy)) 1303 - return PTR_ERR_OR_ZERO(gpio_privacy); 1302 + if (!gpio_privacy) 1303 + return 0; 1304 + 1305 + if (IS_ERR(gpio_privacy)) 1306 + return dev_err_probe(&dev->intf->dev, 1307 + PTR_ERR(gpio_privacy), 1308 + "Can't get privacy GPIO\n"); 1304 1309 1305 1310 irq = gpiod_to_irq(gpio_privacy); 1306 1311 if (irq < 0) ··· 2246 2241 2247 2242 /* Parse the associated GPIOs. */ 2248 2243 ret = uvc_gpio_parse(dev); 2249 - if (ret < 0) { 2250 - uvc_dbg(dev, PROBE, "Unable to parse UVC GPIOs\n"); 2244 + if (ret < 0) 2251 2245 goto error; 2252 - } 2253 2246 2254 2247 dev_info(&dev->udev->dev, "Found UVC %u.%02x device %s (%04x:%04x)\n", 2255 2248 dev->uvc_version >> 8, dev->uvc_version & 0xff,