Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content
Commit 8fcf71aa authored by Axel Lin's avatar Axel Lin Committed by Matthew Garrett
Browse files

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: default avatarAxel Lin <axel.lin@gmail.com>
Acked-by: default avatarCorentin Chary <corentin.chary@gmail.com>
Signed-off-by: default avatarMatthew Garrett <mjg@redhat.com>
parent e9298028
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment