[PATCH] crypto: atmel-sha204a - Fix OTP sysfs read and error handling

Lothar Rubusch l.rubusch at gmail.com
Sun Feb 15 22:14:33 PST 2026


Hi Thorsten,

On Sun, Feb 15, 2026 at 10:48 PM Thorsten Blum <thorsten.blum at linux.dev> wrote:
>
> On 15. Feb 2026, at 22:09, Lothar Rubusch wrote:
> > I tried to verify your patch on hardware today, unfortunately it did
> > not work for me.
> >
> > My setup works with current atsha204a module in the below described way. When
> > trying to dump the OTP zone on exactly the same hardware with a patched module,
> > it only prints '0' and nothing more, see below.
> >
> > [...]
>
> Hi Lothar,
>
> thank you for your feedback. I made a small mistake in the return value
> where I forgot to add the previous length 'len'. Sorry about that!
>
> Unfortunately, I don't have the hardware right now to test this - could
> you try if it works with the following change?
>
> Thanks,
> Thorsten
>
>
> diff --git a/drivers/crypto/atmel-sha204a.c b/drivers/crypto/atmel-sha204a.c
> index 793c8d739a0a..431672517dba 100644
> --- a/drivers/crypto/atmel-sha204a.c
> +++ b/drivers/crypto/atmel-sha204a.c
> @@ -134,7 +134,7 @@ static ssize_t otp_show(struct device *dev,
>
>         for (i = 0; i < OTP_ZONE_SIZE; i++)
>                 len += sysfs_emit_at(buf, len, "%02X", otp[i]);
> -       return sysfs_emit_at(buf, len, "\n");
> +       return len + sysfs_emit_at(buf, len, "\n");
> }
> static DEVICE_ATTR_RO(otp);
>

This would work. I'd squash this fixup together with the proposed
patch and resubmit
a fixed version.

8<-------------------------------------------------------------->8
root at dut02:~/atsha204a-modif# insmod atmel-i2c.ko
root at dut02:~/atsha204a-modif# insmod atmel-sha204a.ko
root at dut02:~/atsha204a-modif# cat /sys/bus/i2c/devices/1-0064/atsha204a/otp
0001ED86032D0002154C033750FFFFFF20B0F703DB0CFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
8<-------------------------------------------------------------->8

Best,
L



More information about the linux-arm-kernel mailing list