All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] iio: sx9500: Add missing init in sx9500_buffer_pre{en,dis}able()
@ 2015-06-29  7:14 Geert Uytterhoeven
  2015-06-29  7:36 ` Vlad Dogaru
  0 siblings, 1 reply; 3+ messages in thread
From: Geert Uytterhoeven @ 2015-06-29  7:14 UTC (permalink / raw)
  To: Vlad Dogaru, Jonathan Cameron; +Cc: linux-iio, linux-kernel, Geert Uytterhoeven

drivers/iio/proximity/sx9500.c: In function ‘sx9500_buffer_preenable’:
drivers/iio/proximity/sx9500.c:682: warning: ‘ret’ may be used uninitialized in this function
drivers/iio/proximity/sx9500.c: In function ‘sx9500_buffer_predisable’:
drivers/iio/proximity/sx9500.c:706: warning: ‘ret’ may be used uninitialized in this function

If active_scan_mask is empty, it will loop once more over all channels,
doing nothing.

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
---
 drivers/iio/proximity/sx9500.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/iio/proximity/sx9500.c b/drivers/iio/proximity/sx9500.c
index 2042e375f8351de6..7624cfa2422d4e41 100644
--- a/drivers/iio/proximity/sx9500.c
+++ b/drivers/iio/proximity/sx9500.c
@@ -679,7 +679,7 @@ out:
 static int sx9500_buffer_preenable(struct iio_dev *indio_dev)
 {
 	struct sx9500_data *data = iio_priv(indio_dev);
-	int ret, i;
+	int ret = 0, i;
 
 	mutex_lock(&data->mutex);
 
@@ -703,7 +703,7 @@ static int sx9500_buffer_preenable(struct iio_dev *indio_dev)
 static int sx9500_buffer_predisable(struct iio_dev *indio_dev)
 {
 	struct sx9500_data *data = iio_priv(indio_dev);
-	int ret, i;
+	int ret = 0, i;
 
 	iio_triggered_buffer_predisable(indio_dev);
 
-- 
1.9.1


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

* Re: [PATCH] iio: sx9500: Add missing init in sx9500_buffer_pre{en,dis}able()
  2015-06-29  7:14 [PATCH] iio: sx9500: Add missing init in sx9500_buffer_pre{en,dis}able() Geert Uytterhoeven
@ 2015-06-29  7:36 ` Vlad Dogaru
  2015-07-05 13:19   ` Jonathan Cameron
  0 siblings, 1 reply; 3+ messages in thread
From: Vlad Dogaru @ 2015-06-29  7:36 UTC (permalink / raw)
  To: Geert Uytterhoeven; +Cc: Jonathan Cameron, linux-iio, linux-kernel

On Mon, Jun 29, 2015 at 09:14:33AM +0200, Geert Uytterhoeven wrote:
> drivers/iio/proximity/sx9500.c: In function ‘sx9500_buffer_preenable’:
> drivers/iio/proximity/sx9500.c:682: warning: ‘ret’ may be used uninitialized in this function
> drivers/iio/proximity/sx9500.c: In function ‘sx9500_buffer_predisable’:
> drivers/iio/proximity/sx9500.c:706: warning: ‘ret’ may be used uninitialized in this function
> 
> If active_scan_mask is empty, it will loop once more over all channels,
> doing nothing.
> 
> Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>

Reviewed-by: Vlad Dogaru <vlad.dogaru@intel.com>

I wonder if those functions are ever called with an empty scan mask.
But the fix is correct nonetheless.  Nice catch :)

> ---
>  drivers/iio/proximity/sx9500.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/iio/proximity/sx9500.c b/drivers/iio/proximity/sx9500.c
> index 2042e375f8351de6..7624cfa2422d4e41 100644
> --- a/drivers/iio/proximity/sx9500.c
> +++ b/drivers/iio/proximity/sx9500.c
> @@ -679,7 +679,7 @@ out:
>  static int sx9500_buffer_preenable(struct iio_dev *indio_dev)
>  {
>  	struct sx9500_data *data = iio_priv(indio_dev);
> -	int ret, i;
> +	int ret = 0, i;
>  
>  	mutex_lock(&data->mutex);
>  
> @@ -703,7 +703,7 @@ static int sx9500_buffer_preenable(struct iio_dev *indio_dev)
>  static int sx9500_buffer_predisable(struct iio_dev *indio_dev)
>  {
>  	struct sx9500_data *data = iio_priv(indio_dev);
> -	int ret, i;
> +	int ret = 0, i;
>  
>  	iio_triggered_buffer_predisable(indio_dev);
>  
> -- 
> 1.9.1
> 
> --
> 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] 3+ messages in thread

* Re: [PATCH] iio: sx9500: Add missing init in sx9500_buffer_pre{en,dis}able()
  2015-06-29  7:36 ` Vlad Dogaru
@ 2015-07-05 13:19   ` Jonathan Cameron
  0 siblings, 0 replies; 3+ messages in thread
From: Jonathan Cameron @ 2015-07-05 13:19 UTC (permalink / raw)
  To: Vlad Dogaru, Geert Uytterhoeven; +Cc: linux-iio, linux-kernel

On 29/06/15 08:36, Vlad Dogaru wrote:
> On Mon, Jun 29, 2015 at 09:14:33AM +0200, Geert Uytterhoeven wrote:
>> drivers/iio/proximity/sx9500.c: In function ‘sx9500_buffer_preenable’:
>> drivers/iio/proximity/sx9500.c:682: warning: ‘ret’ may be used uninitialized in this function
>> drivers/iio/proximity/sx9500.c: In function ‘sx9500_buffer_predisable’:
>> drivers/iio/proximity/sx9500.c:706: warning: ‘ret’ may be used uninitialized in this function
>>
>> If active_scan_mask is empty, it will loop once more over all channels,
>> doing nothing.
>>
>> Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
> 
> Reviewed-by: Vlad Dogaru <vlad.dogaru@intel.com>
> 
> I wonder if those functions are ever called with an empty scan mask.
I'm feeling to lazy to check ;)
> But the fix is correct nonetheless.  Nice catch :)
Applied to the fixes-for-4.2 branch of iio.git

Thanks,

Jonathan
> 
>> ---
>>  drivers/iio/proximity/sx9500.c | 4 ++--
>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/iio/proximity/sx9500.c b/drivers/iio/proximity/sx9500.c
>> index 2042e375f8351de6..7624cfa2422d4e41 100644
>> --- a/drivers/iio/proximity/sx9500.c
>> +++ b/drivers/iio/proximity/sx9500.c
>> @@ -679,7 +679,7 @@ out:
>>  static int sx9500_buffer_preenable(struct iio_dev *indio_dev)
>>  {
>>  	struct sx9500_data *data = iio_priv(indio_dev);
>> -	int ret, i;
>> +	int ret = 0, i;
>>  
>>  	mutex_lock(&data->mutex);
>>  
>> @@ -703,7 +703,7 @@ static int sx9500_buffer_preenable(struct iio_dev *indio_dev)
>>  static int sx9500_buffer_predisable(struct iio_dev *indio_dev)
>>  {
>>  	struct sx9500_data *data = iio_priv(indio_dev);
>> -	int ret, i;
>> +	int ret = 0, i;
>>  
>>  	iio_triggered_buffer_predisable(indio_dev);
>>  
>> -- 
>> 1.9.1
>>
>> --
>> 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] 3+ messages in thread

end of thread, other threads:[~2015-07-05 13:19 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-29  7:14 [PATCH] iio: sx9500: Add missing init in sx9500_buffer_pre{en,dis}able() Geert Uytterhoeven
2015-06-29  7:36 ` Vlad Dogaru
2015-07-05 13:19   ` Jonathan Cameron

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.