[PATCH v2 1/2] rockchip: efuse: fix misc_read() return values

Jonas Karlman jonas at kwiboo.se
Sun Mar 26 20:54:33 CEST 2023


Hi John,

On 2023-03-20 19:39, Simon Glass wrote:
> On Tue, 21 Mar 2023 at 06:18, John Keeping <john at metanate.com> wrote:
>>
>> The documentation for misc_read() says:
>>
>>     Return: number of bytes read if OK (may be 0 if EOF), -ve on error
>>
>> The Rockchip efuse driver implements this so it should return the number
>> of bytes read rather than zero on success.  Fix this so that the driver
>> follows the usual contract for read operations.
>>
>> Signed-off-by: John Keeping <john at metanate.com>
>> ---
>> v2:
>> - Fix when block_size > 1 by moving the return value to the main
>>   rockchip_efuse_read() wrapper and leaving the individual
>>   implementations alone (Jonas)
>>
>>  drivers/misc/rockchip-efuse.c | 12 ++++++++----
>>  1 file changed, 8 insertions(+), 4 deletions(-)
> 
> Reviewed-by: Simon Glass <sjg at chromium.org>

With these changes I get the following trying to boot my boards
and having ROCKCHIP_EFUSE/OTP enabled.

  initcall sequence 000000007ffcecc0 failed at call 0000000000202610 (err=-1)
  ### ERROR ### Please RESET the board ###

We need a change to ret value handling in rockchip_cpuid_from_efuse in
arch/arm/mach-rockchip/misc.c to fix this, maybe something like:

        /* read the cpu_id range from the efuses */
        ret = misc_read(dev, cpuid_offset, cpuid, cpuid_length);
-       if (ret) {
+       if (ret < 0) {


Reviewed-by: Jonas Karlman <jonas at kwiboo.se>

Regards,
Jonas


More information about the U-Boot mailing list