aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/platform/x86
diff options
context:
space:
mode:
authorJean Delvare <jdelvare@suse.de>2010-10-21 05:48:47 -0400
committerMatthew Garrett <mjg@redhat.com>2010-10-21 10:10:49 -0400
commitaa13857f13c3d5535904781e264d8f9115e30438 (patch)
tree88493bebeabb3a8d2595569ac3aec968577b4947 /drivers/platform/x86
parent4119617919c243755946699808ffd0f4befa62c7 (diff)
panasonic-laptop: Handle errors properly if they happen
acpi_pcc_retrieve_biosdata() returns success instead of error if HKEY.SINF is invalid. Fix this. Furthermore, if acpi_pcc_retrieve_biosdata() returns an error during device addition, initialization is properly reverted but value 0 is returned, which means success. This would cause a crash when later using or removing the device, so fix this too. Signed-off-by: Jean Delvare <jdelvare@suse.de> Cc: Harald Welte <laforge@gnumonks.org> Cc: Bruno Premont <bonbons@linux-vserver.org> Signed-off-by: Matthew Garrett <mjg@redhat.com>
Diffstat (limited to 'drivers/platform/x86')
-rw-r--r--drivers/platform/x86/panasonic-laptop.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/platform/x86/panasonic-laptop.c b/drivers/platform/x86/panasonic-laptop.c
index b3b9e0458ae1..96dd34155bad 100644
--- a/drivers/platform/x86/panasonic-laptop.c
+++ b/drivers/platform/x86/panasonic-laptop.c
@@ -285,6 +285,7 @@ static int acpi_pcc_retrieve_biosdata(struct pcc_acpi *pcc, u32 *sinf)
285 hkey = buffer.pointer; 285 hkey = buffer.pointer;
286 if (!hkey || (hkey->type != ACPI_TYPE_PACKAGE)) { 286 if (!hkey || (hkey->type != ACPI_TYPE_PACKAGE)) {
287 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid HKEY.SINF\n")); 287 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid HKEY.SINF\n"));
288 status = AE_ERROR;
288 goto end; 289 goto end;
289 } 290 }
290 291
@@ -596,6 +597,7 @@ static int acpi_pcc_hotkey_add(struct acpi_device *device)
596 if (!acpi_pcc_retrieve_biosdata(pcc, pcc->sinf)) { 597 if (!acpi_pcc_retrieve_biosdata(pcc, pcc->sinf)) {
597 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 598 ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
598 "Couldn't retrieve BIOS data\n")); 599 "Couldn't retrieve BIOS data\n"));
600 result = -EIO;
599 goto out_input; 601 goto out_input;
600 } 602 }
601 /* initialize backlight */ 603 /* initialize backlight */