Commit 5e7ea65d authored by Michael Grzeschik's avatar Michael Grzeschik Committed by Greg Kroah-Hartman

usb: gadget: uvc: refactor the check for a valid buffer in the pump worker

By toggling the condition check for a valid buffer, the else path
can be completely avoided.
Signed-off-by: default avatarMichael Grzeschik <m.grzeschik@pengutronix.de>
Link: https://lore.kernel.org/r/20240214-uvc-gadget-cleanup-v1-2-de6d78780459@pengutronix.deSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent ed6cbac8
...@@ -594,10 +594,7 @@ static void uvcg_video_pump(struct work_struct *work) ...@@ -594,10 +594,7 @@ static void uvcg_video_pump(struct work_struct *work)
*/ */
spin_lock_irqsave(&queue->irqlock, flags); spin_lock_irqsave(&queue->irqlock, flags);
buf = uvcg_queue_head(queue); buf = uvcg_queue_head(queue);
if (!buf) {
if (buf != NULL) {
video->encode(req, video, buf);
} else {
/* /*
* Either the queue has been disconnected or no video buffer * Either the queue has been disconnected or no video buffer
* available for bulk transfer. Either way, stop processing * available for bulk transfer. Either way, stop processing
...@@ -607,6 +604,8 @@ static void uvcg_video_pump(struct work_struct *work) ...@@ -607,6 +604,8 @@ static void uvcg_video_pump(struct work_struct *work)
break; break;
} }
video->encode(req, video, buf);
spin_unlock_irqrestore(&queue->irqlock, flags); spin_unlock_irqrestore(&queue->irqlock, flags);
spin_lock_irqsave(&video->req_lock, flags); spin_lock_irqsave(&video->req_lock, flags);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment