[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <65a1d178-8511-a023-2655-94540114086c@gmail.com>
Date: Sat, 12 Mar 2022 22:58:18 +0300
From: Pavel Skripkin <paskripkin@...il.com>
To: trix@...hat.com, mchehab@...nel.org, hverkuil-cisco@...all.nl,
cai.huoqing@...ux.dev, xose.vazquez@...il.com
Cc: linux-media@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] media: stkwebcam: move stk_camera_read_reg() scratch
buffer to struct stk_camera
On 3/12/22 20:30, trix@...hat.com wrote:
> From: Tom Rix <trix@...hat.com>
>
> In stk_camera_read_reg() a single byte buffer is alloc-ed and
> freed on every function call. Since the size is known,
> move the buffer to the struct stk_camera where it will be alloc-ed
> and freed once.
>
> Signed-off-by: Tom Rix <trix@...hat.com>
> ---
> drivers/media/usb/stkwebcam/stk-webcam.c | 11 ++---------
> drivers/media/usb/stkwebcam/stk-webcam.h | 2 ++
> 2 files changed, 4 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/media/usb/stkwebcam/stk-webcam.c b/drivers/media/usb/stkwebcam/stk-webcam.c
> index 5b822214ccc5c..787edb3d47c23 100644
> --- a/drivers/media/usb/stkwebcam/stk-webcam.c
> +++ b/drivers/media/usb/stkwebcam/stk-webcam.c
> @@ -150,25 +150,18 @@ int stk_camera_write_reg(struct stk_camera *dev, u16 index, u8 value)
> int stk_camera_read_reg(struct stk_camera *dev, u16 index, u8 *value)
And just random note: there are 4 possible uninit value bugs.
stk_start_stream() calls stk_camera_read_reg 4 times, but ignores return
values.
stk_camera_read_reg() should have __must_check annotation and return
value should be checked on each call.
If you have time you can take care of it :) Or I will fix it one day...
With regards,
Pavel Skripkin
Powered by blists - more mailing lists