summaryrefslogtreecommitdiffstats
path: root/drivers/platform/x86/classmate-laptop.c
diff options
context:
space:
mode:
authorThadeu Lima de Souza Cascardo <cascardo@holoscopio.com>2010-06-09 21:48:39 +0200
committerMatthew Garrett <mjg@redhat.com>2010-08-03 15:48:46 +0200
commitb95d13eaf3d4ea093aba95c7f615f3b10708a2c4 (patch)
tree932db97cfd3d5c2f4bc2e8bcd99d0cdaa661ed8e /drivers/platform/x86/classmate-laptop.c
parentIPS driver: add GPU busy and turbo checking (diff)
downloadlinux-b95d13eaf3d4ea093aba95c7f615f3b10708a2c4.tar.xz
linux-b95d13eaf3d4ea093aba95c7f615f3b10708a2c4.zip
classmate-laptop: should check for NULL as retval for rfkill_alloc
rfkill_alloc returns NULL when it fails if RFKILL is enabled. When RFKILL is disabled, its return value of ERR_PTR(-ENODEV) is OK to use as all rfkill functions will work with it, as they are simply empty stubs. Reported-by: Alan Jenkins <alan-jenkins@tuffmail.co.uk> Cc: Johannes Berg <johannes@sipsolutions.net> Cc: platform-driver-x86@vger.kernel.org Cc: mjg@redhat.com Cc: don@syst.com.br Cc: rpurdie@rpsys.net Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@holoscopio.com> Signed-off-by: Matthew Garrett <mjg@redhat.com>
Diffstat (limited to 'drivers/platform/x86/classmate-laptop.c')
-rw-r--r--drivers/platform/x86/classmate-laptop.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/drivers/platform/x86/classmate-laptop.c b/drivers/platform/x86/classmate-laptop.c
index 3bf399fe2bbc..73ea76e6f21e 100644
--- a/drivers/platform/x86/classmate-laptop.c
+++ b/drivers/platform/x86/classmate-laptop.c
@@ -573,16 +573,17 @@ static int cmpc_ipml_add(struct acpi_device *acpi)
ipml->rf = rfkill_alloc("cmpc_rfkill", &acpi->dev, RFKILL_TYPE_WLAN,
&cmpc_rfkill_ops, acpi->handle);
- /* rfkill_alloc may fail if RFKILL is disabled. We should still work
- * anyway. */
- if (!IS_ERR(ipml->rf)) {
+ /*
+ * If RFKILL is disabled, rfkill_alloc will return ERR_PTR(-ENODEV).
+ * This is OK, however, since all other uses of the device will not
+ * derefence it.
+ */
+ if (ipml->rf) {
retval = rfkill_register(ipml->rf);
if (retval) {
rfkill_destroy(ipml->rf);
ipml->rf = NULL;
}
- } else {
- ipml->rf = NULL;
}
dev_set_drvdata(&acpi->dev, ipml);