* [PATCH v2] usb: gadget: uvc: avoid assignment in if conditions
@ 2025-07-30 9:04 Darshan Rathod
2025-07-30 11:28 ` Greg KH
0 siblings, 1 reply; 2+ messages in thread
From: Darshan Rathod @ 2025-07-30 9:04 UTC (permalink / raw)
To: gregkh, m.grzeschik; +Cc: linux-usb, linux-kernel, Darshan Rathod
Refactored code to separate assignments from conditional checks.
This improves readability and conforms to kernel coding style
as reported by checkpatch.pl.
Signed-off-by: Darshan Rathod <darshanrathod475@gmail.com>
---
drivers/usb/gadget/function/uvc_video.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/drivers/usb/gadget/function/uvc_video.c b/drivers/usb/gadget/function/uvc_video.c
index fb77b0b21790..d77ee5fd9b21 100644
--- a/drivers/usb/gadget/function/uvc_video.c
+++ b/drivers/usb/gadget/function/uvc_video.c
@@ -777,18 +777,21 @@ int uvcg_video_enable(struct uvc_video *video)
*/
video->is_enabled = true;
- if ((ret = uvcg_queue_enable(&video->queue, 1)) < 0)
+ ret = uvcg_queue_enable(&video->queue, 1);
+ if (ret < 0)
return ret;
- if ((ret = uvc_video_alloc_requests(video)) < 0)
+ ret = uvc_video_alloc_requests(video);
+ if (ret < 0)
return ret;
if (video->max_payload_size) {
video->encode = uvc_video_encode_bulk;
video->payload_size = 0;
- } else
+ } else {
video->encode = video->queue.use_sg ?
uvc_video_encode_isoc_sg : uvc_video_encode_isoc;
+ }
video->req_int_count = 0;
--
2.43.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v2] usb: gadget: uvc: avoid assignment in if conditions
2025-07-30 9:04 [PATCH v2] usb: gadget: uvc: avoid assignment in if conditions Darshan Rathod
@ 2025-07-30 11:28 ` Greg KH
0 siblings, 0 replies; 2+ messages in thread
From: Greg KH @ 2025-07-30 11:28 UTC (permalink / raw)
To: Darshan Rathod; +Cc: m.grzeschik, linux-usb, linux-kernel
On Wed, Jul 30, 2025 at 09:04:11AM +0000, Darshan Rathod wrote:
> Refactored code to separate assignments from conditional checks.
That is not all you did here :(
Please don't work on coding style cleanups for code that you do not know
is allowed to take those types of changes. And especially as a "first
contribution", please work in a subsystem that this type of changes are
explicitly asked for, like drivers/staging/
Work there first, get experience in the kernel development workflow, and
then worry about other parts of the kernel. That saves maintainer time
and energy in reviewing changes that are not correct :(
hope this helps,
greg k-h
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-07-30 11:28 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-30 9:04 [PATCH v2] usb: gadget: uvc: avoid assignment in if conditions Darshan Rathod
2025-07-30 11:28 ` Greg KH
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).