platform-drivers-x86: asus-laptop: fix wrong test for successful registered led_classdev
authorAxel Lin <axel.lin@gmail.com>
Mon, 8 Aug 2011 09:17:18 +0000 (17:17 +0800)
committerMatthew Garrett <mjg@redhat.com>
Mon, 24 Oct 2011 14:52:38 +0000 (16:52 +0200)
commit8fcf71aa0032acbd30b3222f9cb238919ab3b984
tree04f2299615adfef58c098960fbc3524da5981498
parente9298028ee69bda44607156e7348cd32f7ab9360
platform-drivers-x86: asus-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.

Thus to unregister a successful registered led_classdev, we should check
IS_ERR_OR_NULL macro for led_cdev->dev instead of checking if led_cdev->dev
is NULL or not.

we use IS_ERR_OR_NULL instead of IS_ERR because if we havn't call
led_classdev_register, the led_cdev->dev is NULL.

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>
drivers/platform/x86/asus-laptop.c