diff options
Diffstat (limited to 'drivers/rtc/nvmem.c')
-rw-r--r-- | drivers/rtc/nvmem.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/rtc/nvmem.c b/drivers/rtc/nvmem.c index 7502deb6390e..07ede21cee34 100644 --- a/drivers/rtc/nvmem.c +++ b/drivers/rtc/nvmem.c @@ -13,14 +13,17 @@ int devm_rtc_nvmem_register(struct rtc_device *rtc, struct nvmem_config *nvmem_config) { + struct device *dev = rtc->dev.parent; struct nvmem_device *nvmem; if (!nvmem_config) return -ENODEV; - nvmem_config->dev = rtc->dev.parent; + nvmem_config->dev = dev; nvmem_config->owner = rtc->owner; - nvmem = devm_nvmem_register(rtc->dev.parent, nvmem_config); + nvmem = devm_nvmem_register(dev, nvmem_config); + if (IS_ERR(nvmem)) + dev_err(dev, "failed to register nvmem device for RTC\n"); return PTR_ERR_OR_ZERO(nvmem); } |