Re: nvmem: core: Checking the decrementing of reference counters

From: Markus Elfring
Date: Sat Dec 28 2019 - 07:26:33 EST


I have taken another look at the implementation of the function ânvmem_device_releaseâ.
https://elixir.bootlin.com/linux/v5.5-rc3/source/drivers/nvmem/core.c#L421
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/nvmem/core.c?id=bf8d1cd4386535004c4afe7f03d37f9864c9940e#n421

Now I wonder why the statement âput_device(&nvmem->dev)â is performed here
after it was also executed by the function â__nvmem_device_putâ before.
How often should the device reference count be decremented (at the end)?

Regards,
Markus