Skip to content

Commit a6a0f04

Browse files
Joy Chakrabortygregkh
authored andcommitted
misc: microchip: pci1xxxx: Fix return value of nvmem callbacks
Read/write callbacks registered with nvmem core expect 0 to be returned on success and a negative value to be returned on failure. Currently pci1xxxx_otp_read()/pci1xxxx_otp_write() and pci1xxxx_eeprom_read()/pci1xxxx_eeprom_write() return the number of bytes read/written on success. Fix to return 0 on success. Fixes: 9ab5465 ("misc: microchip: pci1xxxx: Add support to read and write into PCI1XXXX EEPROM via NVMEM sysfs") Fixes: 0969001 ("misc: microchip: pci1xxxx: Add support to read and write into PCI1XXXX OTP via NVMEM sysfs") Cc: [email protected] Signed-off-by: Joy Chakraborty <[email protected]> Reviewed-by: Dan Carpenter <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 4e60131 commit a6a0f04

File tree

1 file changed

+0
-4
lines changed

1 file changed

+0
-4
lines changed

drivers/misc/mchp_pci1xxxx/mchp_pci1xxxx_otpe2p.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,6 @@ static int pci1xxxx_eeprom_read(void *priv_t, unsigned int off,
153153

154154
buf[byte] = readl(rb + MMAP_EEPROM_OFFSET(EEPROM_DATA_REG));
155155
}
156-
ret = byte;
157156
error:
158157
release_sys_lock(priv);
159158
return ret;
@@ -197,7 +196,6 @@ static int pci1xxxx_eeprom_write(void *priv_t, unsigned int off,
197196
goto error;
198197
}
199198
}
200-
ret = byte;
201199
error:
202200
release_sys_lock(priv);
203201
return ret;
@@ -258,7 +256,6 @@ static int pci1xxxx_otp_read(void *priv_t, unsigned int off,
258256

259257
buf[byte] = readl(rb + MMAP_OTP_OFFSET(OTP_RD_DATA_OFFSET));
260258
}
261-
ret = byte;
262259
error:
263260
release_sys_lock(priv);
264261
return ret;
@@ -315,7 +312,6 @@ static int pci1xxxx_otp_write(void *priv_t, unsigned int off,
315312
goto error;
316313
}
317314
}
318-
ret = byte;
319315
error:
320316
release_sys_lock(priv);
321317
return ret;

0 commit comments

Comments
 (0)