media: uvcvideo: Fix deferred probing error
commit 387e8939307192d5a852a2afeeb83427fa477151 upstream.
uvc_gpio_parse() can return -EPROBE_DEFER when the GPIOs it depends on
have not yet been probed. This return code should be propagated to the
caller of uvc_probe() to ensure that probing is retried when the required
GPIOs become available.
Currently, this error code is incorrectly converted to -ENODEV,
causing some internal cameras to be ignored.
This commit fixes this issue by propagating the -EPROBE_DEFER error.
Cc: stable@vger.kernel.org
Fixes: 2886477ff9
("media: uvcvideo: Implement UVC_EXT_GPIO_UNIT")
Reviewed-by: Douglas Anderson <dianders@chromium.org>
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Message-ID: <20250313-uvc-eprobedefer-v3-1-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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
c51c0a0be2
commit
a31dce9b56
@@ -2217,13 +2217,16 @@ static int uvc_probe(struct usb_interface *intf,
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Parse the Video Class control descriptor. */
|
/* Parse the Video Class control descriptor. */
|
||||||
if (uvc_parse_control(dev) < 0) {
|
ret = uvc_parse_control(dev);
|
||||||
|
if (ret < 0) {
|
||||||
|
ret = -ENODEV;
|
||||||
uvc_dbg(dev, PROBE, "Unable to parse UVC descriptors\n");
|
uvc_dbg(dev, PROBE, "Unable to parse UVC descriptors\n");
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Parse the associated GPIOs. */
|
/* Parse the associated GPIOs. */
|
||||||
if (uvc_gpio_parse(dev) < 0) {
|
ret = uvc_gpio_parse(dev);
|
||||||
|
if (ret < 0) {
|
||||||
uvc_dbg(dev, PROBE, "Unable to parse UVC GPIOs\n");
|
uvc_dbg(dev, PROBE, "Unable to parse UVC GPIOs\n");
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
@@ -2249,24 +2252,32 @@ static int uvc_probe(struct usb_interface *intf,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Register the V4L2 device. */
|
/* Register the V4L2 device. */
|
||||||
if (v4l2_device_register(&intf->dev, &dev->vdev) < 0)
|
ret = v4l2_device_register(&intf->dev, &dev->vdev);
|
||||||
|
if (ret < 0)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
/* Scan the device for video chains. */
|
/* Scan the device for video chains. */
|
||||||
if (uvc_scan_device(dev) < 0)
|
if (uvc_scan_device(dev) < 0) {
|
||||||
|
ret = -ENODEV;
|
||||||
goto error;
|
goto error;
|
||||||
|
}
|
||||||
|
|
||||||
/* Initialize controls. */
|
/* Initialize controls. */
|
||||||
if (uvc_ctrl_init_device(dev) < 0)
|
if (uvc_ctrl_init_device(dev) < 0) {
|
||||||
|
ret = -ENODEV;
|
||||||
goto error;
|
goto error;
|
||||||
|
}
|
||||||
|
|
||||||
/* Register video device nodes. */
|
/* Register video device nodes. */
|
||||||
if (uvc_register_chains(dev) < 0)
|
if (uvc_register_chains(dev) < 0) {
|
||||||
|
ret = -ENODEV;
|
||||||
goto error;
|
goto error;
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_MEDIA_CONTROLLER
|
#ifdef CONFIG_MEDIA_CONTROLLER
|
||||||
/* Register the media device node */
|
/* Register the media device node */
|
||||||
if (media_device_register(&dev->mdev) < 0)
|
ret = media_device_register(&dev->mdev);
|
||||||
|
if (ret < 0)
|
||||||
goto error;
|
goto error;
|
||||||
#endif
|
#endif
|
||||||
/* Save our data pointer in the interface data. */
|
/* Save our data pointer in the interface data. */
|
||||||
@@ -2300,7 +2311,7 @@ static int uvc_probe(struct usb_interface *intf,
|
|||||||
error:
|
error:
|
||||||
uvc_unregister_video(dev);
|
uvc_unregister_video(dev);
|
||||||
kref_put(&dev->ref, uvc_delete);
|
kref_put(&dev->ref, uvc_delete);
|
||||||
return -ENODEV;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void uvc_disconnect(struct usb_interface *intf)
|
static void uvc_disconnect(struct usb_interface *intf)
|
||||||
|
Reference in New Issue
Block a user