From aa13857f13c3d5535904781e264d8f9115e30438 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Thu, 21 Oct 2010 11:48:47 +0200 Subject: 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 Cc: Harald Welte Cc: Bruno Premont Signed-off-by: Matthew Garrett --- drivers/platform/x86/panasonic-laptop.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'drivers/platform/x86/panasonic-laptop.c') 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) hkey = buffer.pointer; if (!hkey || (hkey->type != ACPI_TYPE_PACKAGE)) { ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid HKEY.SINF\n")); + status = AE_ERROR; goto end; } @@ -596,6 +597,7 @@ static int acpi_pcc_hotkey_add(struct acpi_device *device) if (!acpi_pcc_retrieve_biosdata(pcc, pcc->sinf)) { ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Couldn't retrieve BIOS data\n")); + result = -EIO; goto out_input; } /* initialize backlight */ -- cgit v1.2.3