rtc: class: add debug message when registration fails

Add a message when __rtc_register_device fails because rtc->ops is NULL.
This may only happen when developing a new driver so use dev_dbg to avoid
compiling it in by default.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Link: https://lore.kernel.org/r/20190818220041.17833-1-alexandre.belloni@bootlin.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
This commit is contained in:
Alexandre Belloni 2019-08-19 00:00:40 +02:00
parent cb36cf803f
commit 924068e50a
1 changed files with 3 additions and 1 deletions

View File

@ -346,8 +346,10 @@ int __rtc_register_device(struct module *owner, struct rtc_device *rtc)
struct rtc_wkalrm alrm;
int err;
if (!rtc->ops)
if (!rtc->ops) {
dev_dbg(&rtc->dev, "no ops set\n");
return -EINVAL;
}
rtc->owner = owner;
rtc_device_get_offset(rtc);