diff mbox

ACPI/fan: Initialize acpi_state variable

Message ID 1372331314-31010-1-git-send-email-naresh.bhat@linaro.org
State New
Headers show

Commit Message

naresh.bhat@linaro.org June 27, 2013, 11:08 a.m. UTC
From: Naresh Bhat <naresh.bhat@linaro.org>

  CC      drivers/acpi/fan.o
drivers/acpi/fan.c: In function ‘fan_get_cur_state’:
drivers/acpi/fan.c:96:9: warning: ‘acpi_state’ may be used uninitialized in this function [-Wuninitialized]
---
 drivers/acpi/fan.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Rafael J. Wysocki June 27, 2013, 12:28 p.m. UTC | #1
On Thursday, June 27, 2013 04:38:34 PM naresh.bhat@linaro.org wrote:
> From: Naresh Bhat <naresh.bhat@linaro.org>
> 
>   CC      drivers/acpi/fan.o
> drivers/acpi/fan.c: In function ‘fan_get_cur_state’:
> drivers/acpi/fan.c:96:9: warning: ‘acpi_state’ may be used uninitialized in this function [-Wuninitialized]
> ---
>  drivers/acpi/fan.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/acpi/fan.c b/drivers/acpi/fan.c
> index f815da8..f61f7fd 100644
> --- a/drivers/acpi/fan.c
> +++ b/drivers/acpi/fan.c
> @@ -84,7 +84,7 @@ static int fan_get_cur_state(struct thermal_cooling_device *cdev, unsigned long
>  {
>  	struct acpi_device *device = cdev->devdata;
>  	int result;
> -	int acpi_state;
> +	int acpi_state = 0;

Please use an appropriate symbol here.

>  
>  	if (!device)
>  		return -EINVAL;
> 

Thanks,
Rafael
naresh.bhat@linaro.org June 27, 2013, 1:05 p.m. UTC | #2
Hi Rafael,

You mean I need to initialize using ACPI_STATE_D0 ? and resend the patch ?

Thanks
-Naresh Bhat


On 27 June 2013 17:58, Rafael J. Wysocki <rjw@sisk.pl> wrote:

> On Thursday, June 27, 2013 04:38:34 PM naresh.bhat@linaro.org wrote:
> > From: Naresh Bhat <naresh.bhat@linaro.org>
> >
> >   CC      drivers/acpi/fan.o
> > drivers/acpi/fan.c: In function ‘fan_get_cur_state’:
> > drivers/acpi/fan.c:96:9: warning: ‘acpi_state’ may be used uninitialized
> in this function [-Wuninitialized]
> > ---
> >  drivers/acpi/fan.c |    2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/acpi/fan.c b/drivers/acpi/fan.c
> > index f815da8..f61f7fd 100644
> > --- a/drivers/acpi/fan.c
> > +++ b/drivers/acpi/fan.c
> > @@ -84,7 +84,7 @@ static int fan_get_cur_state(struct
> thermal_cooling_device *cdev, unsigned long
> >  {
> >       struct acpi_device *device = cdev->devdata;
> >       int result;
> > -     int acpi_state;
> > +     int acpi_state = 0;
>
> Please use an appropriate symbol here.
>
> >
> >       if (!device)
> >               return -EINVAL;
> >
>
> Thanks,
> Rafael
>
>
> --
> I speak only for myself.
> Rafael J. Wysocki, Intel Open Source Technology Center.
>
naresh.bhat@linaro.org June 27, 2013, 1:07 p.m. UTC | #3
Hi Rafael,

You mean I need to initialize using ACPI_STATE_D0 ? and resend the patch ?

Thanks
-Naresh Bhat

On 27 June 2013 17:58, Rafael J. Wysocki <rjw@sisk.pl> wrote:
> On Thursday, June 27, 2013 04:38:34 PM naresh.bhat@linaro.org wrote:
>> From: Naresh Bhat <naresh.bhat@linaro.org>
>>
>>   CC      drivers/acpi/fan.o
>> drivers/acpi/fan.c: In function ‘fan_get_cur_state’:
>> drivers/acpi/fan.c:96:9: warning: ‘acpi_state’ may be used uninitialized in this function [-Wuninitialized]
>> ---
>>  drivers/acpi/fan.c |    2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/acpi/fan.c b/drivers/acpi/fan.c
>> index f815da8..f61f7fd 100644
>> --- a/drivers/acpi/fan.c
>> +++ b/drivers/acpi/fan.c
>> @@ -84,7 +84,7 @@ static int fan_get_cur_state(struct thermal_cooling_device *cdev, unsigned long
>>  {
>>       struct acpi_device *device = cdev->devdata;
>>       int result;
>> -     int acpi_state;
>> +     int acpi_state = 0;
>
> Please use an appropriate symbol here.
>
>>
>>       if (!device)
>>               return -EINVAL;
>>
>
> Thanks,
> Rafael
>
>
> --
> I speak only for myself.
> Rafael J. Wysocki, Intel Open Source Technology Center.
Rafael J. Wysocki June 27, 2013, 7:29 p.m. UTC | #4
On Thursday, June 27, 2013 06:37:35 PM Naresh Bhat wrote:
> Hi Rafael,
> 
> You mean I need to initialize using ACPI_STATE_D0 ? and resend the patch ?

Yes, please.

Although this is a false positive anyway ...

Thanks,
Rafael


> On 27 June 2013 17:58, Rafael J. Wysocki <rjw@sisk.pl> wrote:
> > On Thursday, June 27, 2013 04:38:34 PM naresh.bhat@linaro.org wrote:
> >> From: Naresh Bhat <naresh.bhat@linaro.org>
> >>
> >>   CC      drivers/acpi/fan.o
> >> drivers/acpi/fan.c: In function ‘fan_get_cur_state’:
> >> drivers/acpi/fan.c:96:9: warning: ‘acpi_state’ may be used uninitialized in this function [-Wuninitialized]
> >> ---
> >>  drivers/acpi/fan.c |    2 +-
> >>  1 file changed, 1 insertion(+), 1 deletion(-)
> >>
> >> diff --git a/drivers/acpi/fan.c b/drivers/acpi/fan.c
> >> index f815da8..f61f7fd 100644
> >> --- a/drivers/acpi/fan.c
> >> +++ b/drivers/acpi/fan.c
> >> @@ -84,7 +84,7 @@ static int fan_get_cur_state(struct thermal_cooling_device *cdev, unsigned long
> >>  {
> >>       struct acpi_device *device = cdev->devdata;
> >>       int result;
> >> -     int acpi_state;
> >> +     int acpi_state = 0;
> >
> > Please use an appropriate symbol here.
> >
> >>
> >>       if (!device)
> >>               return -EINVAL;
> >>
> >
> > Thanks,
> > Rafael
> >
> >
> > --
> > I speak only for myself.
> > Rafael J. Wysocki, Intel Open Source Technology Center.
naresh.bhat@linaro.org June 27, 2013, 7:49 p.m. UTC | #5
Done.

Thank you very much

-Naresh Bhat

On 28 June 2013 00:59, Rafael J. Wysocki <rjw@sisk.pl> wrote:
> On Thursday, June 27, 2013 06:37:35 PM Naresh Bhat wrote:
>> Hi Rafael,
>>
>> You mean I need to initialize using ACPI_STATE_D0 ? and resend the patch ?
>
> Yes, please.
>
> Although this is a false positive anyway ...
>
> Thanks,
> Rafael
>
>
>> On 27 June 2013 17:58, Rafael J. Wysocki <rjw@sisk.pl> wrote:
>> > On Thursday, June 27, 2013 04:38:34 PM naresh.bhat@linaro.org wrote:
>> >> From: Naresh Bhat <naresh.bhat@linaro.org>
>> >>
>> >>   CC      drivers/acpi/fan.o
>> >> drivers/acpi/fan.c: In function ‘fan_get_cur_state’:
>> >> drivers/acpi/fan.c:96:9: warning: ‘acpi_state’ may be used uninitialized in this function [-Wuninitialized]
>> >> ---
>> >>  drivers/acpi/fan.c |    2 +-
>> >>  1 file changed, 1 insertion(+), 1 deletion(-)
>> >>
>> >> diff --git a/drivers/acpi/fan.c b/drivers/acpi/fan.c
>> >> index f815da8..f61f7fd 100644
>> >> --- a/drivers/acpi/fan.c
>> >> +++ b/drivers/acpi/fan.c
>> >> @@ -84,7 +84,7 @@ static int fan_get_cur_state(struct thermal_cooling_device *cdev, unsigned long
>> >>  {
>> >>       struct acpi_device *device = cdev->devdata;
>> >>       int result;
>> >> -     int acpi_state;
>> >> +     int acpi_state = 0;
>> >
>> > Please use an appropriate symbol here.
>> >
>> >>
>> >>       if (!device)
>> >>               return -EINVAL;
>> >>
>> >
>> > Thanks,
>> > Rafael
>> >
>> >
>> > --
>> > I speak only for myself.
>> > Rafael J. Wysocki, Intel Open Source Technology Center.
> --
> I speak only for myself.
> Rafael J. Wysocki, Intel Open Source Technology Center.
diff mbox

Patch

diff --git a/drivers/acpi/fan.c b/drivers/acpi/fan.c
index f815da8..f61f7fd 100644
--- a/drivers/acpi/fan.c
+++ b/drivers/acpi/fan.c
@@ -84,7 +84,7 @@  static int fan_get_cur_state(struct thermal_cooling_device *cdev, unsigned long
 {
 	struct acpi_device *device = cdev->devdata;
 	int result;
-	int acpi_state;
+	int acpi_state = 0;
 
 	if (!device)
 		return -EINVAL;