All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2 RESEND] rtc: rtc-hid-sensor-time: improve error handling when rtc register fails
@ 2013-08-01 18:39 Alexander Holler
  2013-08-01 18:39 ` [PATCH 2/2 RESEND] rtc: rtc-hid-sensor-time: enable HID input processing early Alexander Holler
  0 siblings, 1 reply; 9+ messages in thread
From: Alexander Holler @ 2013-08-01 18:39 UTC (permalink / raw)
  To: linux-kernel; +Cc: Andrew Morton, rtc-linux, Alessandro Zummo, Alexander Holler

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>
---
 drivers/rtc/rtc-hid-sensor-time.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/rtc/rtc-hid-sensor-time.c b/drivers/rtc/rtc-hid-sensor-time.c
index 7273b01..1ab3d13 100644
--- a/drivers/rtc/rtc-hid-sensor-time.c
+++ b/drivers/rtc/rtc-hid-sensor-time.c
@@ -283,9 +283,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;
-- 
1.8.1.4


^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2013-08-09 17:11 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-08-01 18:39 [PATCH 1/2 RESEND] rtc: rtc-hid-sensor-time: improve error handling when rtc register fails Alexander Holler
2013-08-01 18:39 ` [PATCH 2/2 RESEND] rtc: rtc-hid-sensor-time: enable HID input processing early Alexander Holler
2013-08-08 22:11   ` Andrew Morton
2013-08-09  9:45     ` [rtc-linux] " Alexander Holler
2013-08-09 11:12       ` Jiri Kosina
2013-08-09 16:21         ` Alexander Holler
2013-08-09 16:33           ` Alexander Holler
2013-08-09 17:02             ` David Herrmann
2013-08-09 17:10               ` Alexander Holler

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.