On Wed, Jun 12, 2024 at 2:53 PM Dan Carpenter dan.carpenter@linaro.org wrote:
On Wed, Jun 12, 2024 at 08:36:35AM +0000, Joy Chakraborty wrote:
Read/write callbacks registered with nvmem core expect 0 to be returned on success and a negative value to be returned on failure.
cmos_nvram_read()/cmos_nvram_write() currently return the number of bytes read or written, fix to return 0 on success and -EIO incase number of bytes requested was not read or written.
Fixes: 8b5b7958fd1c ("rtc: cmos: use generic nvmem") Cc: stable@vger.kernel.org Signed-off-by: Joy Chakraborty joychakr@google.com
Thanks!
Reviewed-by: Dan Carpenter dan.carpenter@linaro.org
After we fix all the these, can we add a warning once message to detect when people introduce new bugs? It could either go into __nvmem_reg_read/write() or bin_attr_nvmem_read/write(). I think bin_attr_nvmem_read() is the only caller where the buggy functions work but that's the caller that most people use I guess.
Sure I can do that. Yes, I think most users use this via sysfs using bin_attr_nvmem_read() hence it works.
Thanks Joy
regards, dan carpenter