ACPI/fan: Initialize acpi_state variable

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

Commit Message

naresh.bhat@linaro.org June 27, 2013, 7:47 p.m.
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

naresh.bhat@linaro.org July 1, 2013, 12:01 p.m. | #1
Hi Rafeal,

I appreciate if you give any feedback on the provided patch.

Thanks
-Naresh Bhat

On 28 June 2013 01:17,  <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..f961435 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 = ACPI_STATE_D0;
>
>         if (!device)
>                 return -EINVAL;
> --
> 1.7.9.5
>
Rafael J. Wysocki July 1, 2013, 1:59 p.m. | #2
On Monday, July 01, 2013 05:31:46 PM Naresh Bhat wrote:
> Hi Rafeal,
> 
> I appreciate if you give any feedback on the provided patch.

The patch is OK, but please add your sign-off.

Thanks,
Rafael


> On 28 June 2013 01:17,  <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..f961435 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 = ACPI_STATE_D0;
> >
> >         if (!device)
> >                 return -EINVAL;
> > --
> > 1.7.9.5
> >
naresh.bhat@linaro.org July 1, 2013, 2:25 p.m. | #3
Opps sorry about that. I have added my sign-off and send the patch.

Thanks
Naresh Bhat

On 1 July 2013 19:29, Rafael J. Wysocki <rjw@sisk.pl> wrote:
> On Monday, July 01, 2013 05:31:46 PM Naresh Bhat wrote:
>> Hi Rafeal,
>>
>> I appreciate if you give any feedback on the provided patch.
>
> The patch is OK, but please add your sign-off.
>
> Thanks,
> Rafael
>
>
>> On 28 June 2013 01:17,  <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..f961435 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 = ACPI_STATE_D0;
>> >
>> >         if (!device)
>> >                 return -EINVAL;
>> > --
>> > 1.7.9.5
>> >
> --
> I speak only for myself.
> Rafael J. Wysocki, Intel Open Source Technology Center.

Patch

diff --git a/drivers/acpi/fan.c b/drivers/acpi/fan.c
index f815da8..f961435 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 = ACPI_STATE_D0;
 
 	if (!device)
 		return -EINVAL;