Commit 7707bda3 authored by Alexander Holler's avatar Alexander Holler Committed by Linus Torvalds

drivers/rtc/rtc-hid-sensor-time.c: improve error handling when rtc register fails

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: default avatarAlexander Holler <holler@ahsoftware.de>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 666a584d
...@@ -279,9 +279,11 @@ static int hid_time_probe(struct platform_device *pdev) ...@@ -279,9 +279,11 @@ static int hid_time_probe(struct platform_device *pdev)
"hid-sensor-time", &hid_time_rtc_ops, "hid-sensor-time", &hid_time_rtc_ops,
THIS_MODULE); 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"); dev_err(&pdev->dev, "rtc device register failed!\n");
return PTR_ERR(time_state->rtc);
} }
return ret; return ret;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment