summaryrefslogtreecommitdiff
path: root/drivers/rtc/rtc-hid-sensor-time.c
diff options
context:
space:
mode:
authorAlexander Holler <holler@ahsoftware.de>2013-09-11 14:24:20 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2013-09-11 15:58:55 -0700
commit7707bda3ee4aa4415090755c22e5a9c03fc530dc (patch)
tree9fc4f89cc9ffcc0dd494df142093a68007f1660a /drivers/rtc/rtc-hid-sensor-time.c
parent666a584d3a765a914642f80deef7a33fb309df5d (diff)
downloadlwn-7707bda3ee4aa4415090755c22e5a9c03fc530dc.tar.gz
lwn-7707bda3ee4aa4415090755c22e5a9c03fc530dc.zip
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: Alexander Holler <holler@ahsoftware.de> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/rtc/rtc-hid-sensor-time.c')
-rw-r--r--drivers/rtc/rtc-hid-sensor-time.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/rtc/rtc-hid-sensor-time.c b/drivers/rtc/rtc-hid-sensor-time.c
index b5a2874b15ef..4e2a81854f51 100644
--- a/drivers/rtc/rtc-hid-sensor-time.c
+++ b/drivers/rtc/rtc-hid-sensor-time.c
@@ -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;