From: Ricardo Ribalda Date: Fri, 23 May 2025 14:28:41 +0000 (+0000) Subject: media: uvcvideo: Populate all errors in uvc_probe() X-Git-Tag: v6.17-rc1~90^2~307 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cdf8f4c78ab0c2dc98dd5b017b0a31590c3e046d;p=thirdparty%2Flinux.git media: uvcvideo: Populate all errors in uvc_probe() Now we are replacing most of the error codes with -ENODEV. Instead, Populate the error code from the functions called by uvc_probe(). Take this opportunity to replace a generic error code from uvc_scan_device() into something more meaningful. Suggested-by: Laurent Pinchart Signed-off-by: Ricardo Ribalda Reviewed-by: Laurent Pinchart Reviewed-by: Hans de Goede Link: https://lore.kernel.org/r/20250523-uvc-followup-v2-1-487541656e83@chromium.org Signed-off-by: Hans de Goede Signed-off-by: Laurent Pinchart Signed-off-by: Hans Verkuil --- diff --git a/drivers/media/usb/uvc/uvc_driver.c b/drivers/media/usb/uvc/uvc_driver.c index da24a655ab68c..04552da114354 100644 --- a/drivers/media/usb/uvc/uvc_driver.c +++ b/drivers/media/usb/uvc/uvc_driver.c @@ -1866,7 +1866,7 @@ static int uvc_scan_device(struct uvc_device *dev) if (list_empty(&dev->chains)) { dev_info(&dev->udev->dev, "No valid video chain found.\n"); - return -1; + return -ENODEV; } /* Add GPIO entity to the first chain. */ @@ -2239,7 +2239,6 @@ static int uvc_probe(struct usb_interface *intf, /* Parse the Video Class control descriptor. */ ret = uvc_parse_control(dev); if (ret < 0) { - ret = -ENODEV; uvc_dbg(dev, PROBE, "Unable to parse UVC descriptors\n"); goto error; } @@ -2275,22 +2274,19 @@ static int uvc_probe(struct usb_interface *intf, goto error; /* Scan the device for video chains. */ - if (uvc_scan_device(dev) < 0) { - ret = -ENODEV; + ret = uvc_scan_device(dev); + if (ret < 0) goto error; - } /* Initialize controls. */ - if (uvc_ctrl_init_device(dev) < 0) { - ret = -ENODEV; + ret = uvc_ctrl_init_device(dev); + if (ret < 0) goto error; - } /* Register video device nodes. */ - if (uvc_register_chains(dev) < 0) { - ret = -ENODEV; + ret = uvc_register_chains(dev); + if (ret < 0) goto error; - } #ifdef CONFIG_MEDIA_CONTROLLER /* Register the media device node */