public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
From: Hans Verkuil <hansverk@cisco.com>
To: Guennadi Liakhovetski <g.liakhovetski@gmx.de>,
	Hans Verkuil <hverkuil@xs4all.nl>
Cc: linux-media@vger.kernel.org, Hans Verkuil <hans.verkuil@cisco.com>
Subject: Re: [PATCH 9/9] mt9t112: initialize left and top
Date: Mon, 04 May 2015 09:43:47 +0200	[thread overview]
Message-ID: <55472333.7000204@cisco.com> (raw)
In-Reply-To: <Pine.LNX.4.64.1505040937020.9253@axis700.grange>

On 05/04/2015 09:40 AM, Guennadi Liakhovetski wrote:
> On Mon, 4 May 2015, Hans Verkuil wrote:
> 
>> On 05/03/2015 11:02 PM, Guennadi Liakhovetski wrote:
>>> Hi Hans,
>>>
>>> On Sun, 3 May 2015, Hans Verkuil wrote:
>>>
>>>> From: Hans Verkuil <hans.verkuil@cisco.com>
>>>>
>>>> The left and top variables were uninitialized, leading to unexpected
>>>> results.
>>>>
>>>> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
>>>> ---
>>>>  drivers/media/i2c/soc_camera/mt9t112.c | 3 ++-
>>>>  1 file changed, 2 insertions(+), 1 deletion(-)
>>>>
>>>> diff --git a/drivers/media/i2c/soc_camera/mt9t112.c b/drivers/media/i2c/soc_camera/mt9t112.c
>>>> index de10a76..02190d6 100644
>>>> --- a/drivers/media/i2c/soc_camera/mt9t112.c
>>>> +++ b/drivers/media/i2c/soc_camera/mt9t112.c
>>>> @@ -952,7 +952,8 @@ static int mt9t112_set_fmt(struct v4l2_subdev *sd,
>>>>  	struct v4l2_mbus_framefmt *mf = &format->format;
>>>>  	struct i2c_client *client = v4l2_get_subdevdata(sd);
>>>>  	struct mt9t112_priv *priv = to_mt9t112(client);
>>>> -	unsigned int top, left;
>>>> +	unsigned int top = priv->frame.top;
>>>> +	unsigned int left = priv->frame.left;
>>>
>>> I don't think this is needed. We don't care about left and top in 
>>> mt9t112_set_fmt().
>>
>> On further analysis you are correct, it will work with random left/top
>> values. But I think it is 1) very unexpected and 2) bad form to leave it
>> with random values.
>>
>> I prefer to keep this patch, unless you disagree.
> 
> Sorry, but I do. Assigning those specific values to left and top makes the 
> code even more confusing, it makes it look like that makes any sense, 
> whereas it doesn't. If anything we can add a comment there. Or we can pass 
> NULL and make sure to catch it somewhere down the line.
> 

What about this:

	unsigned int top = 0; /* don't care */
	unsigned int left = 0; /* don't care */

Regards,

	Hans

> Thanks
> Guennadi
> 
>> Regards,
>>
>> 	Hans
>>
>>>
>>> How about my comment about a duplicated call to mt9t112_set_params()? Can 
>>> we have it fixed too?
>>>
>>> Thanks
>>> Guennadi
>>>
>>>>  	int i;
>>>>  
>>>>  	if (format->pad)
>>>> -- 
>>>> 2.1.4
>>>>
>>


  reply	other threads:[~2015-05-04  7:43 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-03  9:54 [PATCH 0/9] soc-camera sensor improvements Hans Verkuil
2015-05-03  9:54 ` [PATCH 1/9] imx074: don't call imx074_find_datafmt() twice Hans Verkuil
2015-05-03 17:54   ` Guennadi Liakhovetski
2015-05-04  7:22     ` Hans Verkuil
2015-05-03  9:54 ` [PATCH 2/9] mt9m001: avoid calling mt9m001_find_datafmt() twice Hans Verkuil
2015-05-03 17:56   ` Guennadi Liakhovetski
2015-05-03  9:54 ` [PATCH 3/9] mt9v022: avoid calling mt9v022_find_datafmt() twice Hans Verkuil
2015-05-03 17:57   ` Guennadi Liakhovetski
2015-05-03  9:54 ` [PATCH 4/9] ov2640: avoid calling ov2640_select_win() twice Hans Verkuil
2015-05-03 18:19   ` Guennadi Liakhovetski
2015-05-04  7:25     ` Hans Verkuil
2015-05-03  9:54 ` [PATCH 5/9] ov5642: avoid calling ov5642_find_datafmt() twice Hans Verkuil
2015-05-03 20:24   ` Guennadi Liakhovetski
2015-05-04  7:26     ` Hans Verkuil
2015-05-03  9:54 ` [PATCH 6/9] ov772x: avoid calling ov772x_select_params() twice Hans Verkuil
2015-05-03 20:30   ` Guennadi Liakhovetski
2015-05-03  9:54 ` [PATCH 7/9] ov9640: avoid calling ov9640_res_roundup() twice Hans Verkuil
2015-05-03 20:34   ` Guennadi Liakhovetski
2015-05-03  9:54 ` [PATCH 8/9] ov9740: avoid calling ov9740_res_roundup() twice Hans Verkuil
2015-05-03 20:47   ` Guennadi Liakhovetski
2015-05-04 10:20     ` Hans Verkuil
2015-05-03  9:54 ` [PATCH 9/9] mt9t112: initialize left and top Hans Verkuil
2015-05-03 21:02   ` Guennadi Liakhovetski
2015-05-03 21:09     ` Guennadi Liakhovetski
2015-05-04  7:31     ` Hans Verkuil
2015-05-04  7:40       ` Guennadi Liakhovetski
2015-05-04  7:43         ` Hans Verkuil [this message]
2015-05-04  7:54           ` Guennadi Liakhovetski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=55472333.7000204@cisco.com \
    --to=hansverk@cisco.com \
    --cc=g.liakhovetski@gmx.de \
    --cc=hans.verkuil@cisco.com \
    --cc=hverkuil@xs4all.nl \
    --cc=linux-media@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox