]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
crypto: atmel-sha204a - Fix error codes in OTP reads
authorThorsten Blum <thorsten.blum@linux.dev>
Sun, 15 Feb 2026 20:51:53 +0000 (21:51 +0100)
committerHerbert Xu <herbert@gondor.apana.org.au>
Sat, 28 Feb 2026 03:54:14 +0000 (12:54 +0900)
commit094c276da6a0d4971c3faae09a36b51d096659b2
treec707aa3ffb4b75c0bfc00bfa4bdc7773fc9e6780
parentb7abbc8c7acaeb60c114b038f1fa91bbedb3d16a
crypto: atmel-sha204a - Fix error codes in OTP reads

Return -EINVAL from atmel_i2c_init_read_otp_cmd() on invalid addresses
instead of -1. Since the OTP zone is accessed in 4-byte blocks, valid
addresses range from 0 to OTP_ZONE_SIZE / 4 - 1. Fix the bounds check
accordingly.

In atmel_sha204a_otp_read(), propagate the actual error code from
atmel_i2c_init_read_otp_cmd() instead of -1. Also, return -EIO instead
of -EINVAL when the device is not ready.

Cc: stable@vger.kernel.org
Fixes: e05ce444e9e5 ("crypto: atmel-sha204a - add reading from otp zone")
Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
Reviewed-by: Lothar Rubusch <l.rubusch@gmail.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
drivers/crypto/atmel-i2c.c
drivers/crypto/atmel-sha204a.c