mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* ACPI fan driver: uninitialized variable when CONFIG_PM is not set
@ 2013-04-29 12:32 Michel Lespinasse
  2013-05-16  1:07 ` Zhang Rui
  0 siblings, 1 reply; 4+ messages in thread
From: Michel Lespinasse @ 2013-04-29 12:32 UTC (permalink / raw)
  To: Zhang Rui; +Cc: linux-acpi, LKML

In the following code:

static int fan_get_cur_state(struct thermal_cooling_device *cdev, unsigned long
                             *state)
{
        struct acpi_device *device = cdev->devdata;
        int result;
        int acpi_state;

        if (!device)
                return -EINVAL;

        result = acpi_bus_update_power(device->handle, &acpi_state);
        if (result)
                return result;

        *state = (acpi_state == ACPI_STATE_D3 ? 0 :
                 (acpi_state == ACPI_STATE_D0 ? 1 : -1));
        return 0;
}

With CONFIG_PM not set, acpi_bus_update_power() returns 0 and does not
initialize acpi_state. This results in acpi_state being used before
initialization.

(I found out by random chance, as I suppose people don't normally
build without CONFIG_PM anymore ?)

I'm not sure what a proper fix would be, so I'll just report this here
and enable CONFIG_PM locally :)

-- 
Michel "Walken" Lespinasse
A program is never fully debugged until the last user dies.

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

* Re: ACPI fan driver: uninitialized variable when CONFIG_PM is not set
  2013-04-29 12:32 ACPI fan driver: uninitialized variable when CONFIG_PM is not set Michel Lespinasse
@ 2013-05-16  1:07 ` Zhang Rui
  2013-05-16  7:56   ` Michel Lespinasse
  0 siblings, 1 reply; 4+ messages in thread
From: Zhang Rui @ 2013-05-16  1:07 UTC (permalink / raw)
  To: Michel Lespinasse; +Cc: linux-acpi, LKML, Rafael J. Wysocki

Hi, Michel,

On Mon, 2013-04-29 at 05:32 -0700, Michel Lespinasse wrote:
> In the following code:
> 
> static int fan_get_cur_state(struct thermal_cooling_device *cdev, unsigned long
>                              *state)
> {
>         struct acpi_device *device = cdev->devdata;
>         int result;
>         int acpi_state;
> 
>         if (!device)
>                 return -EINVAL;
> 
>         result = acpi_bus_update_power(device->handle, &acpi_state);
>         if (result)
>                 return result;
> 
>         *state = (acpi_state == ACPI_STATE_D3 ? 0 :
>                  (acpi_state == ACPI_STATE_D0 ? 1 : -1));
>         return 0;
> }
> 
> With CONFIG_PM not set, acpi_bus_update_power() returns 0 and does not
> initialize acpi_state. This results in acpi_state being used before
> initialization.
> 
> (I found out by random chance, as I suppose people don't normally
> build without CONFIG_PM anymore ?)
> 
> I'm not sure what a proper fix would be, so I'll just report this here
> and enable CONFIG_PM locally :)
> 
thanks for your report.
please check if the following patch helps or not.
https://patchwork.kernel.org/patch/2574691/

thanks,
rui


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

* Re: ACPI fan driver: uninitialized variable when CONFIG_PM is not set
  2013-05-16  1:07 ` Zhang Rui
@ 2013-05-16  7:56   ` Michel Lespinasse
  2013-05-16  8:47     ` Rafael J. Wysocki
  0 siblings, 1 reply; 4+ messages in thread
From: Michel Lespinasse @ 2013-05-16  7:56 UTC (permalink / raw)
  To: Zhang Rui; +Cc: linux-acpi, LKML, Rafael J. Wysocki

On Wed, May 15, 2013 at 6:07 PM, Zhang Rui <rui.zhang@intel.com> wrote:
> Hi, Michel,
>
> thanks for your report.
> please check if the following patch helps or not.
> https://patchwork.kernel.org/patch/2574691/

Yes, this solves the issue.

Is there a chance that this will make it into 3.10 ?

Thanks,

-- 
Michel "Walken" Lespinasse
A program is never fully debugged until the last user dies.

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

* Re: ACPI fan driver: uninitialized variable when CONFIG_PM is not set
  2013-05-16  7:56   ` Michel Lespinasse
@ 2013-05-16  8:47     ` Rafael J. Wysocki
  0 siblings, 0 replies; 4+ messages in thread
From: Rafael J. Wysocki @ 2013-05-16  8:47 UTC (permalink / raw)
  To: Michel Lespinasse; +Cc: Zhang Rui, linux-acpi, LKML

On Thursday, May 16, 2013 12:56:37 AM Michel Lespinasse wrote:
> On Wed, May 15, 2013 at 6:07 PM, Zhang Rui <rui.zhang@intel.com> wrote:
> > Hi, Michel,
> >
> > thanks for your report.
> > please check if the following patch helps or not.
> > https://patchwork.kernel.org/patch/2574691/
> 
> Yes, this solves the issue.
> 
> Is there a chance that this will make it into 3.10 ?

Yes, there is.

Thanks,
Rafael


-- 
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.

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

end of thread, other threads:[~2013-05-16  8:39 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-04-29 12:32 ACPI fan driver: uninitialized variable when CONFIG_PM is not set Michel Lespinasse
2013-05-16  1:07 ` Zhang Rui
2013-05-16  7:56   ` Michel Lespinasse
2013-05-16  8:47     ` Rafael J. Wysocki

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

all inboxes | Powered by JetHome®