public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] iio: common: ssp_sensors: Fix uninitialized warning for timestamp
@ 2015-04-16  9:30 Karol Wrona
  2015-04-18 19:02 ` Jonathan Cameron
  0 siblings, 1 reply; 4+ messages in thread
From: Karol Wrona @ 2015-04-16  9:30 UTC (permalink / raw)
  To: linux-iio, Jonathan Cameron
  Cc: linux-kernel, Hartmut Knaack, Lars-Peter Clausen, Peter Meerwald,
	Karol Wrona, Karol Wrona

calculated_time variable caused warning as uninitialized.  It was not harmful
because it was evaluated in the path in which was used later but it is to
satisfy the checkers.

Signed-off-by: Karol Wrona <k.wrona@samsung.com>
---
 drivers/iio/common/ssp_sensors/ssp_iio.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iio/common/ssp_sensors/ssp_iio.c b/drivers/iio/common/ssp_sensors/ssp_iio.c
index a3ae165..16180e6 100644
--- a/drivers/iio/common/ssp_sensors/ssp_iio.c
+++ b/drivers/iio/common/ssp_sensors/ssp_iio.c
@@ -80,7 +80,7 @@ int ssp_common_process_data(struct iio_dev *indio_dev, void *buf,
 			    unsigned int len, int64_t timestamp)
 {
 	__le32 time;
-	int64_t calculated_time;
+	int64_t calculated_time = 0;
 	struct ssp_sensor_data *spd = iio_priv(indio_dev);
 
 	if (indio_dev->scan_bytes == 0)
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] iio: common: ssp_sensors: Fix uninitialized warning for timestamp
  2015-04-16  9:30 [PATCH] iio: common: ssp_sensors: Fix uninitialized warning for timestamp Karol Wrona
@ 2015-04-18 19:02 ` Jonathan Cameron
  2015-04-24 11:10   ` Karol Wrona
  0 siblings, 1 reply; 4+ messages in thread
From: Jonathan Cameron @ 2015-04-18 19:02 UTC (permalink / raw)
  To: Karol Wrona, linux-iio
  Cc: linux-kernel, Hartmut Knaack, Lars-Peter Clausen, Peter Meerwald,
	Karol Wrona

On 16/04/15 10:30, Karol Wrona wrote:
> calculated_time variable caused warning as uninitialized.  It was not harmful
> because it was evaluated in the path in which was used later but it is to
> satisfy the checkers.
> 
> Signed-off-by: Karol Wrona <k.wrona@samsung.com>
Dumb compiler. It's a false positive and as the function is an inline in the header,
it should be able to tell. 

What compiler is spitting out the warning?

> ---
>  drivers/iio/common/ssp_sensors/ssp_iio.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/iio/common/ssp_sensors/ssp_iio.c b/drivers/iio/common/ssp_sensors/ssp_iio.c
> index a3ae165..16180e6 100644
> --- a/drivers/iio/common/ssp_sensors/ssp_iio.c
> +++ b/drivers/iio/common/ssp_sensors/ssp_iio.c
> @@ -80,7 +80,7 @@ int ssp_common_process_data(struct iio_dev *indio_dev, void *buf,
>  			    unsigned int len, int64_t timestamp)
>  {
>  	__le32 time;
> -	int64_t calculated_time;
> +	int64_t calculated_time = 0;
>  	struct ssp_sensor_data *spd = iio_priv(indio_dev);
>  
>  	if (indio_dev->scan_bytes == 0)
> 


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] iio: common: ssp_sensors: Fix uninitialized warning for timestamp
  2015-04-18 19:02 ` Jonathan Cameron
@ 2015-04-24 11:10   ` Karol Wrona
  2015-04-26 17:01     ` Jonathan Cameron
  0 siblings, 1 reply; 4+ messages in thread
From: Karol Wrona @ 2015-04-24 11:10 UTC (permalink / raw)
  To: Jonathan Cameron, linux-iio
  Cc: linux-kernel, Hartmut Knaack, Lars-Peter Clausen, Peter Meerwald,
	Karol Wrona

On 04/18/2015 09:02 PM, Jonathan Cameron wrote:
> On 16/04/15 10:30, Karol Wrona wrote:
>> calculated_time variable caused warning as uninitialized.  It was not harmful
>> because it was evaluated in the path in which was used later but it is to
>> satisfy the checkers.
>>
>> Signed-off-by: Karol Wrona <k.wrona@samsung.com>
> Dumb compiler. It's a false positive and as the function is an inline in the header,
> it should be able to tell. 
> 
> What compiler is spitting out the warning?


You should have krobot complain in the mail.
Subject: "include/linux/iio/buffer.h:142:32: warning: 'calculated_time'
may be used uninitialized in this function"

This was sh compiler. I suppose that we can treat it as false warning.
It will complain whenever the variable will stay uninitialized even if
not used in such path.


> 
>> ---
>>  drivers/iio/common/ssp_sensors/ssp_iio.c |    2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/iio/common/ssp_sensors/ssp_iio.c b/drivers/iio/common/ssp_sensors/ssp_iio.c
>> index a3ae165..16180e6 100644
>> --- a/drivers/iio/common/ssp_sensors/ssp_iio.c
>> +++ b/drivers/iio/common/ssp_sensors/ssp_iio.c
>> @@ -80,7 +80,7 @@ int ssp_common_process_data(struct iio_dev *indio_dev, void *buf,
>>  			    unsigned int len, int64_t timestamp)
>>  {
>>  	__le32 time;
>> -	int64_t calculated_time;
>> +	int64_t calculated_time = 0;
>>  	struct ssp_sensor_data *spd = iio_priv(indio_dev);
>>  
>>  	if (indio_dev->scan_bytes == 0)
>>
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-iio" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] iio: common: ssp_sensors: Fix uninitialized warning for timestamp
  2015-04-24 11:10   ` Karol Wrona
@ 2015-04-26 17:01     ` Jonathan Cameron
  0 siblings, 0 replies; 4+ messages in thread
From: Jonathan Cameron @ 2015-04-26 17:01 UTC (permalink / raw)
  To: Karol Wrona, linux-iio
  Cc: linux-kernel, Hartmut Knaack, Lars-Peter Clausen, Peter Meerwald,
	Karol Wrona

On 24/04/15 12:10, Karol Wrona wrote:
> On 04/18/2015 09:02 PM, Jonathan Cameron wrote:
>> On 16/04/15 10:30, Karol Wrona wrote:
>>> calculated_time variable caused warning as uninitialized.  It was not harmful
>>> because it was evaluated in the path in which was used later but it is to
>>> satisfy the checkers.
>>>
>>> Signed-off-by: Karol Wrona <k.wrona@samsung.com>
>> Dumb compiler. It's a false positive and as the function is an inline in the header,
>> it should be able to tell. 
>>
>> What compiler is spitting out the warning?
> 
> 
> You should have krobot complain in the mail.
> Subject: "include/linux/iio/buffer.h:142:32: warning: 'calculated_time'
> may be used uninitialized in this function"
> 
> This was sh compiler. I suppose that we can treat it as false warning.
> It will complain whenever the variable will stay uninitialized even if
> not used in such path.
Yup. Seems false to me.  Could report it if you are really bored :)
> 
> 
>>
>>> ---
>>>  drivers/iio/common/ssp_sensors/ssp_iio.c |    2 +-
>>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/iio/common/ssp_sensors/ssp_iio.c b/drivers/iio/common/ssp_sensors/ssp_iio.c
>>> index a3ae165..16180e6 100644
>>> --- a/drivers/iio/common/ssp_sensors/ssp_iio.c
>>> +++ b/drivers/iio/common/ssp_sensors/ssp_iio.c
>>> @@ -80,7 +80,7 @@ int ssp_common_process_data(struct iio_dev *indio_dev, void *buf,
>>>  			    unsigned int len, int64_t timestamp)
>>>  {
>>>  	__le32 time;
>>> -	int64_t calculated_time;
>>> +	int64_t calculated_time = 0;
>>>  	struct ssp_sensor_data *spd = iio_priv(indio_dev);
>>>  
>>>  	if (indio_dev->scan_bytes == 0)
>>>
>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-iio" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>>
> 


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-04-26 17:01 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-04-16  9:30 [PATCH] iio: common: ssp_sensors: Fix uninitialized warning for timestamp Karol Wrona
2015-04-18 19:02 ` Jonathan Cameron
2015-04-24 11:10   ` Karol Wrona
2015-04-26 17:01     ` Jonathan Cameron

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox