Skip to contentSkip to conversation

rockchip: misc: read the correct number of bytes from the efuse

PATCH New Heiko Stuebner 3 participants 4 messages Sep 25, 2019 – Sep 29, 2019

Subsystems (3)
lore
Share & tools
lore

Heiko Stuebner

author maintainer
#0 lore raw

PATCH 1/1 rockchip: misc: read the correct number of bytes from the efuse

Originally the cpuid var the value gets read into was defined as

    u8 cpuid[RK3399_CPUID_LEN];

hence the sizeof(cpuid) would return the correct the correct number of array elements.

With the move to a separate function cpuid becomes a pointer and sizeof(cpuid) hence returns the pointer size - 8 in the arm64 case.

We do have the actual id length available as function param so use it for actual amount of bytes to read.

Fixes 04825384999f ("rockchip: rk3399: derive ethaddr from cpuid")
---
 arch/arm/mach-rockchip/misc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/mach-rockchip/misc.c +1 -1
index 4423b296b1..bed4317f7e 100644
@@ -75,7 +75,7 @@ int rockchip_cpuid_from_efuse(const u32 cpuid_offset,
 	}
 
 	/* read the cpu_id range from the efuses */
-	ret = misc_read(dev, cpuid_offset, cpuid, sizeof(cpuid));
+	ret = misc_read(dev, cpuid_offset, cpuid, cpuid_length);
 	if (ret) {
 		debug("%s: reading cpuid from the efuses failed\n",
 		      __func__);
Signature · 1 line
2.23.0
#1 lore raw

PATCH 1/1 rockchip: misc: read the correct number of bytes from the efuse

Quoted 9 lines · Heiko Stuebner

Originally the cpuid var the value gets read into was defined as
u8 cpuid[RK3399_CPUID_LEN];
hence the sizeof(cpuid) would return the correct the correct number of array elements.

Quoted 8 lines

With the move to a separate function cpuid becomes a pointer and sizeof(cpuid) hence returns the pointer size - 8 in the arm64 case.

We do have the actual id length available as function param so use it for actual amount of bytes to read.

Fixes 04825384999f ("rockchip: rk3399: derive ethaddr from cpuid")
#2 lore raw

PATCH 1/1 rockchip: misc: read the correct number of bytes from the efuse

In reply to Heiko Stuebner
Quoted 5 lines · Heiko Stuebner

Originally the cpuid var the value gets read into was defined as

     u8 cpuid[RK3399_CPUID_LEN];

hence the sizeof(cpuid) would return the correct the correct number of array elements.

Quoted 8 lines

With the move to a separate function cpuid becomes a pointer and sizeof(cpuid) hence returns the pointer size - 8 in the arm64 case.

We do have the actual id length available as function param so use it for actual amount of bytes to read.

Fixes 04825384999f ("rockchip: rk3399: derive ethaddr from cpuid")

Thanks,
- Kever

Quoted 17 lines
---
  arch/arm/mach-rockchip/misc.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/mach-rockchip/misc.c +1 -1
index 4423b296b1..bed4317f7e 100644
@@ -75,7 +75,7 @@ int rockchip_cpuid_from_efuse(const u32 cpuid_offset,
  	}
 
  	/* read the cpu_id range from the efuses */
-	ret = misc_read(dev, cpuid_offset, cpuid, sizeof(cpuid));
+	ret = misc_read(dev, cpuid_offset, cpuid, cpuid_length);
  	if (ret) {
  		debug("%s: reading cpuid from the efuses failed\n",
  		      __func__);
#3 lore raw

PATCH 1/1 rockchip: misc: read the correct number of bytes from the efuse【请注意,邮件由[email protected]代发】

Quoted 10 lines · Kever Yang
Quoted 8 lines · Heiko Stuebner

Originally the cpuid var the value gets read into was defined as u8 cpuid[RK3399_CPUID_LEN];
hence the sizeof(cpuid) would return the correct the correct number of array elements.

With the move to a separate function cpuid becomes a pointer and sizeof(cpuid) hence returns the pointer size - 8 in the arm64 case.

Quoted 7 lines
Quoted 5 lines

We do have the actual id length available as function param so use it for actual amount of bytes to read.

Fixes 04825384999f ("rockchip: rk3399: derive ethaddr from cpuid")

Applied to u-boot-rockchip/master.

Quoted 26 lines

Thanks,
- Kever

Quoted 10 lines

---
  arch/arm/mach-rockchip/misc.c | 2 +-

  1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/mach-rockchip/misc.c +0 -0
index 4423b296b1..bed4317f7e 100644

arch/arm/mach-rockchip/misc.c int rockchip_cpuid_from_efuse(const u32 cpuid_offset, · line 80

Quoted 7 lines
arch/arm/mach-rockchip/misc.c +1 -1
@@ -75,7 +75,7 @@ int rockchip_cpuid_from_efuse(const u32 cpuid_offset,
       }
         /* read the cpu_id range from the efuses */
-    ret = misc_read(dev, cpuid_offset, cpuid, sizeof(cpuid));
+    ret = misc_read(dev, cpuid_offset, cpuid, cpuid_length);
       if (ret) {
           debug("%s: reading cpuid from the efuses failed\n",
                 __func__);

_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
https://lists.denx.de/listinfo/u-boot