lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87frz750he.fsf@gmail.com>
Date: Mon, 08 Jan 2024 17:57:33 +0300
From: Mikhail Rudenko <mike.rudenko@...il.com>
To: Sakari Ailus <sakari.ailus@....fi>
Cc: linux-media@...r.kernel.org, linux-kernel@...r.kernel.org, Sakari Ailus
 <sakari.ailus@...ux.intel.com>, Laurent Pinchart
 <laurent.pinchart@...asonboard.com>, Jacopo Mondi <jacopo@...ndi.org>,
 Tommaso Merciai <tomm.merciai@...il.com>, Christophe JAILLET
 <christophe.jaillet@...adoo.fr>, Dave Stevenson
 <dave.stevenson@...pberrypi.com>, Mauro Carvalho Chehab
 <mchehab@...nel.org>
Subject: Re: [PATCH v2 06/20] media: i2c: ov4689: Refactor ov4689_set_ctrl



Hi Sakari,

Thanks for the review!

On 2024-01-08 at 11:16 GMT, Sakari Ailus <sakari.ailus@....fi> wrote:

> Hi Mikhail,
>
> On Mon, Dec 18, 2023 at 08:40:27PM +0300, Mikhail Rudenko wrote:
>> Introduce local variable for regmap within the ov4689_set_ctrl
>> function. This adjustment eliminates repetition within the function.
>>
>> Signed-off-by: Mikhail Rudenko <mike.rudenko@...il.com>
>> ---
>>  drivers/media/i2c/ov4689.c | 11 +++++------
>>  1 file changed, 5 insertions(+), 6 deletions(-)
>>
>> diff --git a/drivers/media/i2c/ov4689.c b/drivers/media/i2c/ov4689.c
>> index 3b20eba59c9c..d42f5d1a1ba8 100644
>> --- a/drivers/media/i2c/ov4689.c
>> +++ b/drivers/media/i2c/ov4689.c
>> @@ -580,6 +580,7 @@ static int ov4689_set_ctrl(struct v4l2_ctrl *ctrl)
>>  {
>>  	struct ov4689 *ov4689 =
>>  		container_of(ctrl->handler, struct ov4689, ctrl_handler);
>> +	struct regmap *regmap = ov4689->regmap;
>>  	struct device *dev = ov4689->dev;
>>  	int sensor_gain;
>>  	s64 max_expo;
>> @@ -603,16 +604,15 @@ static int ov4689_set_ctrl(struct v4l2_ctrl *ctrl)
>>  	switch (ctrl->id) {
>>  	case V4L2_CID_EXPOSURE:
>>  		/* 4 least significant bits of exposure are fractional part */
>> -		ret = cci_write(ov4689->regmap, OV4689_REG_EXPOSURE,
>> -				ctrl->val << 4, NULL);
>> +		cci_write(regmap, OV4689_REG_EXPOSURE, ctrl->val << 4, &ret);
>
> If you do this, ret needs to have been initialised to 0, but it isn't.
>
> Same for the changes below.

Nice catch, will fix it in v3.

>>  		break;
>>  	case V4L2_CID_ANALOGUE_GAIN:
>>  		ret = ov4689_map_gain(ov4689, ctrl->val, &sensor_gain);
>> -		cci_write(ov4689->regmap, OV4689_REG_GAIN, sensor_gain, &ret);
>> +		cci_write(regmap, OV4689_REG_GAIN, sensor_gain, &ret);
>>  		break;
>>  	case V4L2_CID_VBLANK:
>> -		ret = cci_write(ov4689->regmap, OV4689_REG_VTS,
>> -				ctrl->val + ov4689->cur_mode->height, NULL);
>> +		cci_write(regmap, OV4689_REG_VTS,
>> +			  ctrl->val + ov4689->cur_mode->height, &ret);
>>  		break;
>>  	case V4L2_CID_TEST_PATTERN:
>>  		ret = ov4689_enable_test_pattern(ov4689, ctrl->val);
>> @@ -625,7 +625,6 @@ static int ov4689_set_ctrl(struct v4l2_ctrl *ctrl)
>>  	}
>>
>>  	pm_runtime_put(dev);
>> -
>
> I thought it was nice.

Will get the blank line back in v3, especially since "Use runtime
autosuspend" patch (09/20) restores it.

>>  	return ret;
>>  }
>>


--
Best regards,
Mikhail Rudenko

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ