Skip to content

Commit 3328eb4

Browse files
ribaldahverkuil
authored andcommitted
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 <[email protected]> Reviewed-by: Douglas Anderson <[email protected]> Signed-off-by: Ricardo Ribalda <[email protected]> Message-ID: <[email protected]> Reviewed-by: Hans de Goede <[email protected]> Signed-off-by: Hans de Goede <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
1 parent 387e893 commit 3328eb4

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

drivers/media/usb/uvc/uvc_driver.c

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1299,8 +1299,13 @@ static int uvc_gpio_parse(struct uvc_device *dev)
12991299

13001300
gpio_privacy = devm_gpiod_get_optional(&dev->intf->dev, "privacy",
13011301
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");
13041309

13051310
irq = gpiod_to_irq(gpio_privacy);
13061311
if (irq < 0)
@@ -2241,10 +2246,8 @@ static int uvc_probe(struct usb_interface *intf,
22412246

22422247
/* Parse the associated GPIOs. */
22432248
ret = uvc_gpio_parse(dev);
2244-
if (ret < 0) {
2245-
uvc_dbg(dev, PROBE, "Unable to parse UVC GPIOs\n");
2249+
if (ret < 0)
22462250
goto error;
2247-
}
22482251

22492252
dev_info(&dev->udev->dev, "Found UVC %u.%02x device %s (%04x:%04x)\n",
22502253
dev->uvc_version >> 8, dev->uvc_version & 0xff,

0 commit comments

Comments
 (0)