From: Michel Lespinasse <walken@google.com>
To: Zhang Rui <rui.zhang@intel.com>
Cc: linux-acpi@vger.kernel.org, LKML <linux-kernel@vger.kernel.org>
Subject: ACPI fan driver: uninitialized variable when CONFIG_PM is not set
Date: Mon, 29 Apr 2013 05:32:11 -0700 [thread overview]
Message-ID: <CANN689GoQm8dGEN6L1xuuc_aZ_65G3N7tBPbEXHjAfebB7xrLw@mail.gmail.com> (raw)
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.
next reply other threads:[~2013-04-29 12:32 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-29 12:32 Michel Lespinasse [this message]
2013-05-16 1:07 ` Zhang Rui
2013-05-16 7:56 ` Michel Lespinasse
2013-05-16 8:47 ` Rafael J. Wysocki
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CANN689GoQm8dGEN6L1xuuc_aZ_65G3N7tBPbEXHjAfebB7xrLw@mail.gmail.com \
--to=walken@google.com \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rui.zhang@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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®