Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ab3ea36e authored by Alexandre Belloni's avatar Alexandre Belloni
Browse files

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: default avatarAlexandre Belloni <alexandre.belloni@bootlin.com>
parent 2cc82121
Loading
Loading
Loading
Loading
+3 −0
Original line number Original line Diff line number Diff line
@@ -87,6 +87,9 @@ static void rtc_nvram_unregister(struct rtc_device *rtc)
int rtc_nvmem_register(struct rtc_device *rtc,
int rtc_nvmem_register(struct rtc_device *rtc,
		       struct nvmem_config *nvmem_config)
		       struct nvmem_config *nvmem_config)
{
{
	if (!IS_ERR_OR_NULL(rtc->nvmem))
		return -EBUSY;

	if (!nvmem_config)
	if (!nvmem_config)
		return -ENODEV;
		return -ENODEV;