diff options
author | Bartosz Golaszewski <bgolaszewski@baylibre.com> | 2020-11-09 19:34:07 +0300 |
---|---|---|
committer | Alexandre Belloni <alexandre.belloni@bootlin.com> | 2020-11-19 14:50:12 +0300 |
commit | 6746bc095bbd1da719aadd9a11fe2c75a12f22e0 (patch) | |
tree | 74cdc6fa8455551cb60ea21e32ab3072d0b951ea /drivers/rtc/nvmem.c | |
parent | 3a905c2d9544a418953d6c18668f0f853fbd9be9 (diff) | |
download | linux-6746bc095bbd1da719aadd9a11fe2c75a12f22e0.tar.xz |
rtc: nvmem: emit an error message when nvmem registration fails
Some users check the return value of devm_rtc_nvmem_register() only in
order to emit an error message and then continue probing. This is fine
as an rtc can function without exposing nvmem but let's generalize it:
let's make the registration function emit the error message so that
users don't have to.
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Link: https://lore.kernel.org/r/20201109163409.24301-7-brgl@bgdev.pl
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); } |