All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] rockchip: misc: read the correct number of bytes from the efuse
@ 2019-09-25 18:40 Heiko Stuebner
  2019-09-25 22:42 ` Philipp Tomsich
  2019-09-27  0:58 ` Kever Yang
  0 siblings, 2 replies; 4+ messages in thread
From: Heiko Stuebner @ 2019-09-25 18:40 UTC (permalink / raw)
  To: u-boot

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")
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
---
 arch/arm/mach-rockchip/misc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/mach-rockchip/misc.c b/arch/arm/mach-rockchip/misc.c
index 4423b296b1..bed4317f7e 100644
--- a/arch/arm/mach-rockchip/misc.c
+++ b/arch/arm/mach-rockchip/misc.c
@@ -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__);
-- 
2.23.0

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [U-Boot] [PATCH] rockchip: misc: read the correct number of bytes from the efuse
  2019-09-25 18:40 [U-Boot] [PATCH] rockchip: misc: read the correct number of bytes from the efuse Heiko Stuebner
@ 2019-09-25 22:42 ` Philipp Tomsich
  2019-09-27  0:58 ` Kever Yang
  1 sibling, 0 replies; 4+ messages in thread
From: Philipp Tomsich @ 2019-09-25 22:42 UTC (permalink / raw)
  To: u-boot



> On 25.09.2019, at 20:40, Heiko Stuebner <heiko@sntech.de> wrote:
> 
> 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")
> Signed-off-by: Heiko Stuebner <heiko@sntech.de>

Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [U-Boot] [PATCH] rockchip: misc: read the correct number of bytes from the efuse
  2019-09-25 18:40 [U-Boot] [PATCH] rockchip: misc: read the correct number of bytes from the efuse Heiko Stuebner
  2019-09-25 22:42 ` Philipp Tomsich
@ 2019-09-27  0:58 ` Kever Yang
  2019-09-29  0:55   ` [U-Boot] [PATCH] rockchip: misc: read the correct number of bytes from the efuse【请注意,邮件由u-boot-bounces@lists.denx.de代发】 Kever Yang
  1 sibling, 1 reply; 4+ messages in thread
From: Kever Yang @ 2019-09-27  0:58 UTC (permalink / raw)
  To: u-boot


On 2019/9/26 上午2:40, Heiko Stuebner wrote:
> 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")
> Signed-off-by: Heiko Stuebner <heiko@sntech.de>

Reviewed-by: Kever Yang<kever.yang@rock-chips.com>

Thanks,
- Kever
> ---
>   arch/arm/mach-rockchip/misc.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/arm/mach-rockchip/misc.c b/arch/arm/mach-rockchip/misc.c
> index 4423b296b1..bed4317f7e 100644
> --- a/arch/arm/mach-rockchip/misc.c
> +++ b/arch/arm/mach-rockchip/misc.c
> @@ -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__);

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [U-Boot] [PATCH] rockchip: misc: read the correct number of bytes from the efuse【请注意,邮件由u-boot-bounces@lists.denx.de代发】
  2019-09-27  0:58 ` Kever Yang
@ 2019-09-29  0:55   ` Kever Yang
  0 siblings, 0 replies; 4+ messages in thread
From: Kever Yang @ 2019-09-29  0:55 UTC (permalink / raw)
  To: u-boot


On 2019/9/27 上午8:58, Kever Yang wrote:
>
> On 2019/9/26 上午2:40, Heiko Stuebner wrote:
>> 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")
>> Signed-off-by: Heiko Stuebner <heiko@sntech.de>
>
> Reviewed-by: Kever Yang<kever.yang@rock-chips.com>

Applied to u-boot-rockchip/master.


>
> Thanks,
> - Kever
>> ---
>>   arch/arm/mach-rockchip/misc.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/arch/arm/mach-rockchip/misc.c 
>> b/arch/arm/mach-rockchip/misc.c
>> index 4423b296b1..bed4317f7e 100644
>> --- a/arch/arm/mach-rockchip/misc.c
>> +++ b/arch/arm/mach-rockchip/misc.c
>> @@ -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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-09-29  0:55 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-25 18:40 [U-Boot] [PATCH] rockchip: misc: read the correct number of bytes from the efuse Heiko Stuebner
2019-09-25 22:42 ` Philipp Tomsich
2019-09-27  0:58 ` Kever Yang
2019-09-29  0:55   ` [U-Boot] [PATCH] rockchip: misc: read the correct number of bytes from the efuse【请注意,邮件由u-boot-bounces@lists.denx.de代发】 Kever Yang

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.