[PATCH] crypto: atmel-sha204a - Fix error codes in OTP reads

Thorsten Blum thorsten.blum at linux.dev
Sat Feb 28 01:57:51 PST 2026


On 28. Feb 2026, at 09:48, Herbert Xu wrote:
> On Sun, Feb 15, 2026 at 09:51:53PM +0100, Thorsten Blum wrote:
>> 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 at vger.kernel.org
>> Fixes: e05ce444e9e5 ("crypto: atmel-sha204a - add reading from otp zone")
>> Signed-off-by: Thorsten Blum <thorsten.blum at linux.dev>
>> ---
>> Compile-tested only.
>> ---
>> drivers/crypto/atmel-i2c.c     | 4 ++--
>> drivers/crypto/atmel-sha204a.c | 7 ++++---
>> 2 files changed, 6 insertions(+), 5 deletions(-)
> 
> Patch applied.  Thanks.

Hi Herbert,

I also submitted [1], which combines this patch here and patch [2] after
Lothar suggested to squash them. Feel free to apply them separately or
together. Just FYI.

Thanks,
Thorsten

[1] https://lore.kernel.org/lkml/20260224225547.683713-2-thorsten.blum@linux.dev/
[2] https://lore.kernel.org/lkml/20260220133135.1122081-2-thorsten.blum@linux.dev/




More information about the linux-arm-kernel mailing list