Re: [PATCH 2/2] media: i2c: Add driver for ST VD56G3 camera sensor

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Sakari,

On 5/27/24 09:31, Sakari Ailus wrote:
> Hi Benjamin,
> 
> On Mon, May 13, 2024 at 03:37:25PM +0200, Benjamin Mugnier wrote:
>>>>> +static int vd56g3_read_expo_cluster(struct vd56g3 *sensor, bool force_cur_val)
>>>>> +{
>>>>> +	u64 exposure = 0;
>>>>> +	u64 again = 0;
>>>>> +	u64 dgain = 0;
>>>>
>>>> Do you need the assignments? The values are assigned by cci_read() below,
>>>> right?
>>>
>>> Well initially, I didn't have those assignments and some checker
>>> complains (Honestly I didn't investigate the warning).
>>> I will double check and see if they are necessary.
>>>
>>
>> Since I have smatch ready, I ran it without these initialization against
>> the latest media tree. I got these :
>>
>> drivers/media/i2c/st-vd56g3.c:403 vd56g3_read_expo_cluster() error:
>> uninitialized symbol 'exposure'.
>> drivers/media/i2c/st-vd56g3.c:404 vd56g3_read_expo_cluster() error:
>> uninitialized symbol 'again'.
>> drivers/media/i2c/st-vd56g3.c:405 vd56g3_read_expo_cluster() error:
>> uninitialized symbol 'dgain'.
>> drivers/media/i2c/st-vd56g3.c:407 vd56g3_read_expo_cluster() error:
>> uninitialized symbol 'exposure'.
>> drivers/media/i2c/st-vd56g3.c:408 vd56g3_read_expo_cluster() error:
>> uninitialized symbol 'again'.
>> drivers/media/i2c/st-vd56g3.c:409 vd56g3_read_expo_cluster() error:
>> uninitialized symbol 'dgain'.
>>
>> cci_read() is indeed not modifying its 'var' argument in the default
>> case of the switch [1]. Spawning these errors.
>> Adding a '*val = 0' in the default case would also fix it, but will
>> change the function behavior.
> 
> I think I'd add the assignment to cci_read(). This isn't the only driver
> that's affected. In the best case smatch would be fixed to figure this out.
> 
> Any thoughts?

IMHO adding the assignment to cci_read() is the cleanest way to handle it.

> 
> Cc also Hans and Laurent.
> 

-- 
Regards,

Benjamin




[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux