[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20221212-uvc-race-v2-2-54496cc3b8ab@chromium.org>
Date: Tue, 13 Dec 2022 15:35:31 +0100
From: Ricardo Ribalda <ribalda@...omium.org>
To: Max Staudt <mstaudt@...gle.com>,
Sergey Senozhatsky <senozhatsky@...omium.org>,
Yunke Cao <yunkec@...omium.org>,
Laurent Pinchart <laurent.pinchart@...asonboard.com>,
Mauro Carvalho Chehab <mchehab@...nel.org>
Cc: linux-media@...r.kernel.org, stable@...r.kernel.org,
linux-kernel@...r.kernel.org,
Ricardo Ribalda <ribalda@...omium.org>
Subject: [PATCH v2 2/2] media: uvcvideo: Do not alloc dev->status
UVC_MAX_STATUS_SIZE is 16, simplify the code by inlining dev->status.
Signed-off-by: Ricardo Ribalda <ribalda@...omium.org>
---
drivers/media/usb/uvc/uvc_status.c | 9 +--------
drivers/media/usb/uvc/uvcvideo.h | 2 +-
2 files changed, 2 insertions(+), 9 deletions(-)
diff --git a/drivers/media/usb/uvc/uvc_status.c b/drivers/media/usb/uvc/uvc_status.c
index 09a5802dc974..52999b3b7c48 100644
--- a/drivers/media/usb/uvc/uvc_status.c
+++ b/drivers/media/usb/uvc/uvc_status.c
@@ -259,15 +259,9 @@ int uvc_status_init(struct uvc_device *dev)
uvc_input_init(dev);
- dev->status = kzalloc(UVC_MAX_STATUS_SIZE, GFP_KERNEL);
- if (dev->status == NULL)
- return -ENOMEM;
-
dev->int_urb = usb_alloc_urb(0, GFP_KERNEL);
- if (dev->int_urb == NULL) {
- kfree(dev->status);
+ if (!dev->int_urb)
return -ENOMEM;
- }
pipe = usb_rcvintpipe(dev->udev, ep->desc.bEndpointAddress);
@@ -296,7 +290,6 @@ void uvc_status_unregister(struct uvc_device *dev)
void uvc_status_cleanup(struct uvc_device *dev)
{
usb_free_urb(dev->int_urb);
- kfree(dev->status);
}
int uvc_status_start(struct uvc_device *dev, gfp_t flags)
diff --git a/drivers/media/usb/uvc/uvcvideo.h b/drivers/media/usb/uvc/uvcvideo.h
index 6a9b72d6789e..ccc7e3b60bf1 100644
--- a/drivers/media/usb/uvc/uvcvideo.h
+++ b/drivers/media/usb/uvc/uvcvideo.h
@@ -559,7 +559,7 @@ struct uvc_device {
/* Status Interrupt Endpoint */
struct usb_host_endpoint *int_ep;
struct urb *int_urb;
- u8 *status;
+ u8 status[UVC_MAX_STATUS_SIZE];
bool flush_status;
struct input_dev *input;
char input_phys[64];
--
2.39.0.rc1.256.g54fd8350bd-goog-b4-0.11.0-dev-696ae
Powered by blists - more mailing lists