diff options
author | Alexandre Belloni <alexandre.belloni@bootlin.com> | 2018-02-12 17:47:18 -0500 |
---|---|---|
committer | Alexandre Belloni <alexandre.belloni@bootlin.com> | 2018-02-14 14:58:16 -0500 |
commit | ab3ea36eda76069ba52e9b6aef5a9370b0b462bf (patch) | |
tree | a8d02f3759f5462a49bafe06400fa803781b3dd7 | |
parent | 2cc8212198820487ec3fdcc7b98133701fc9dfc3 (diff) |
rtc: nvmem: disallow registering nvmem more than once
Make rtc_nvmem_register return -EBUSY when an nvmem is already registered
for that RTC.
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
-rw-r--r-- | drivers/rtc/nvmem.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/rtc/nvmem.c b/drivers/rtc/nvmem.c index 293df6db7c42..fd1c39a5ade5 100644 --- a/drivers/rtc/nvmem.c +++ b/drivers/rtc/nvmem.c | |||
@@ -87,6 +87,9 @@ static void rtc_nvram_unregister(struct rtc_device *rtc) | |||
87 | int rtc_nvmem_register(struct rtc_device *rtc, | 87 | int rtc_nvmem_register(struct rtc_device *rtc, |
88 | struct nvmem_config *nvmem_config) | 88 | struct nvmem_config *nvmem_config) |
89 | { | 89 | { |
90 | if (!IS_ERR_OR_NULL(rtc->nvmem)) | ||
91 | return -EBUSY; | ||
92 | |||
90 | if (!nvmem_config) | 93 | if (!nvmem_config) |
91 | return -ENODEV; | 94 | return -ENODEV; |
92 | 95 | ||