summaryrefslogtreecommitdiff
path: root/drivers/platform
diff options
context:
space:
mode:
authorAxel Lin <axel.lin@gmail.com>2011-08-08 13:14:19 +0400
committerMatthew Garrett <mjg@redhat.com>2011-10-24 18:52:38 +0400
commit5d6afd150321a9e6f1180f5dced9032cce6861ac (patch)
tree83442856b52952204938be7873629ac79189a7d6 /drivers/platform
parent33989ba6f7feb3d03916e42d7775d802d2fdea1e (diff)
downloadlinux-5d6afd150321a9e6f1180f5dced9032cce6861ac.tar.xz
platform-drivers-x86: eeepc-laptop: fix wrong test for successful registered led_classdev
device_create returns &struct device pointer on success, or ERR_PTR() on error. Thus if led_classdev_register fails, led_cdev->dev is always not NULL. If IS_ERR(eeepc->tpd_led.dev) is ture, it means led_classdev_register fails. If (asus->tpd_led.dev) is NULL, it means we call eeepc_led_exit before calling led_classdev_register for &eeepc->tpd_led. We only want to call led_classdev_unregister for sucessfully registered led_classdev, then we should check (!IS_ERR_OR_NULL(eeepc->tpd_led.dev)). Signed-off-by: Axel Lin <axel.lin@gmail.com> Acked-by: Corentin Chary <corentin.chary@gmail.com> Signed-off-by: Matthew Garrett <mjg@redhat.com>
Diffstat (limited to 'drivers/platform')
-rw-r--r--drivers/platform/x86/eeepc-laptop.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/platform/x86/eeepc-laptop.c b/drivers/platform/x86/eeepc-laptop.c
index 1c45d92e2163..ea44abd8df48 100644
--- a/drivers/platform/x86/eeepc-laptop.c
+++ b/drivers/platform/x86/eeepc-laptop.c
@@ -568,7 +568,7 @@ static int eeepc_led_init(struct eeepc_laptop *eeepc)
static void eeepc_led_exit(struct eeepc_laptop *eeepc)
{
- if (eeepc->tpd_led.dev)
+ if (!IS_ERR_OR_NULL(eeepc->tpd_led.dev))
led_classdev_unregister(&eeepc->tpd_led);
if (eeepc->led_workqueue)
destroy_workqueue(eeepc->led_workqueue);