rtc: nvmem: use devm_nvmem_register()
Use the resource managed variant of nvmem_register().
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
diff --git a/drivers/rtc/nvmem.c b/drivers/rtc/nvmem.c
index 36ab183..2a7220d 100644
--- a/drivers/rtc/nvmem.c
+++ b/drivers/rtc/nvmem.c
@@ -93,7 +93,7 @@
nvmem_config->dev = rtc->dev.parent;
nvmem_config->owner = rtc->owner;
- rtc->nvmem = nvmem_register(nvmem_config);
+ rtc->nvmem = devm_nvmem_register(rtc->dev.parent, nvmem_config);
if (IS_ERR(rtc->nvmem))
return PTR_ERR(rtc->nvmem);
@@ -107,12 +107,7 @@
void rtc_nvmem_unregister(struct rtc_device *rtc)
{
- if (IS_ERR_OR_NULL(rtc->nvmem))
- return;
-
/* unregister the old ABI */
if (rtc->nvram)
rtc_nvram_unregister(rtc);
-
- nvmem_unregister(rtc->nvmem);
}