]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
drivers/rtc/rtc-hid-sensor-time.c: improve error handling when rtc register fails
authorAlexander Holler <holler@ahsoftware.de>
Wed, 11 Sep 2013 21:24:20 +0000 (14:24 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Wed, 11 Sep 2013 22:58:55 +0000 (15:58 -0700)
Stop processing hid input when registering the RTC fails and handle a NULL
returned from devm_rtc_device_register() as a failure too.

Signed-off-by: Alexander Holler <holler@ahsoftware.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
drivers/rtc/rtc-hid-sensor-time.c

index b5a2874b15efa1db0da3c7cb0d6253688a6fad33..4e2a81854f517cac05b775dd57d234e5d871e15e 100644 (file)
@@ -279,9 +279,11 @@ static int hid_time_probe(struct platform_device *pdev)
                                        "hid-sensor-time", &hid_time_rtc_ops,
                                        THIS_MODULE);
 
-       if (IS_ERR(time_state->rtc)) {
+       if (IS_ERR_OR_NULL(time_state->rtc)) {
+               ret = time_state->rtc ? PTR_ERR(time_state->rtc) : -ENODEV;
+               time_state->rtc = NULL;
+               sensor_hub_remove_callback(hsdev, HID_USAGE_SENSOR_TIME);
                dev_err(&pdev->dev, "rtc device register failed!\n");
-               return PTR_ERR(time_state->rtc);
        }
 
        return ret;