diff mbox

cafe driver need to initialize the chip->ident

Message ID 200905021804.17908.hverkuil@xs4all.nl (mailing list archive)
State RFC
Headers show

Commit Message

Hans Verkuil May 2, 2009, 4:04 p.m. UTC
On Thursday 30 April 2009 14:35:58 saeed bishara wrote:
> Hi,
>     The cafe_cam_init declares un-initialized v4l2_dbg_chip_ident
> structure, then it uses the chip.ident to test if the sensor is known.
>     but, this field is never initialized and it my get random value,
> then later it used by the v4l2_chip_ident_i2c_client function.
>     I think this is bug and it must be fixed by initializing the ident
> field with zero.
>    I'm using kernel 2.6.29.1
> saeed

Thanks! This is indeed wrong and I'll fix it. I think it is sufficient to 
apply this patch:


Can you confirm this? If it works, then I'll merge this patch and see if I 
can get it into the 2.6.29 stable series.

Regards,

	Hans

Comments

saeed bishara May 3, 2009, 7:51 a.m. UTC | #1
tested it, fixed my problem, thanks.

saeed

On Sat, May 2, 2009 at 7:04 PM, Hans Verkuil <hverkuil@xs4all.nl> wrote:
> On Thursday 30 April 2009 14:35:58 saeed bishara wrote:
>> Hi,
>>     The cafe_cam_init declares un-initialized v4l2_dbg_chip_ident
>> structure, then it uses the chip.ident to test if the sensor is known.
>>     but, this field is never initialized and it my get random value,
>> then later it used by the v4l2_chip_ident_i2c_client function.
>>     I think this is bug and it must be fixed by initializing the ident
>> field with zero.
>>    I'm using kernel 2.6.29.1
>> saeed
>
> Thanks! This is indeed wrong and I'll fix it. I think it is sufficient to
> apply this patch:
>
> --- cafe_ccic.c.orig    2009-05-02 17:57:08.000000000 +0200
> +++ cafe_ccic.c 2009-05-02 17:57:37.000000000 +0200
> @@ -868,6 +868,7 @@
>        ret = __cafe_cam_reset(cam);
>        if (ret)
>                goto out;
> +       chip.ident = V4L2_IDENT_NONE;
>        chip.match.type = V4L2_CHIP_MATCH_I2C_ADDR;
>        chip.match.addr = cam->sensor->addr;
>        ret = __cafe_cam_cmd(cam, VIDIOC_DBG_G_CHIP_IDENT, &chip);
>
> Can you confirm this? If it works, then I'll merge this patch and see if I
> can get it into the 2.6.29 stable series.
>
> Regards,
>
>        Hans
>
> --
> Hans Verkuil - video4linux developer - sponsored by TANDBERG Telecom
>
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

--- cafe_ccic.c.orig	2009-05-02 17:57:08.000000000 +0200
+++ cafe_ccic.c	2009-05-02 17:57:37.000000000 +0200
@@ -868,6 +868,7 @@ 
 	ret = __cafe_cam_reset(cam);
 	if (ret)
 		goto out;
+	chip.ident = V4L2_IDENT_NONE;
 	chip.match.type = V4L2_CHIP_MATCH_I2C_ADDR;
 	chip.match.addr = cam->sensor->addr;
 	ret = __cafe_cam_cmd(cam, VIDIOC_DBG_G_CHIP_IDENT, &chip);