]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
media: uvcvideo: Exit early if there is not int_urb
authorRicardo Ribalda <ribalda@chromium.org>
Thu, 26 Sep 2024 05:49:59 +0000 (05:49 +0000)
committerHans Verkuil <hverkuil-cisco@xs4all.nl>
Tue, 8 Oct 2024 14:04:45 +0000 (16:04 +0200)
If there is no int_urb there is no need to do a clean stop.

Also we avoid calling usb_kill_urb(NULL). It is properly handled by the
usb framework, but it is not polite.

Now that we are at it, fix the code style in uvc_status_start() for
consistency.

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Sergey Senozhatsky <senozhatsky@chromium.org>
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Link: https://lore.kernel.org/r/20240926-guenter-mini-v7-3-690441953d4a@chromium.org
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
drivers/media/usb/uvc/uvc_status.c

index 9c5e5e7b7bd7959ffc80f2a72c3adbca472e747e..06c867510c8fe6d051c7814586796700339c3316 100644 (file)
@@ -308,7 +308,7 @@ static int uvc_status_start(struct uvc_device *dev, gfp_t flags)
 {
        lockdep_assert_held(&dev->status_lock);
 
-       if (dev->int_urb == NULL)
+       if (!dev->int_urb)
                return 0;
 
        return usb_submit_urb(dev->int_urb, flags);
@@ -320,6 +320,9 @@ static void uvc_status_stop(struct uvc_device *dev)
 
        lockdep_assert_held(&dev->status_lock);
 
+       if (!dev->int_urb)
+               return;
+
        /*
         * Prevent the asynchronous control handler from requeing the URB. The
         * barrier is needed so the flush_status change is visible to other