Re: [U-Boot] [PATCH 3/9] dm: rtc: Correct rtc_read32() return value

2015-10-21 Thread Simon Glass
On 18 October 2015 at 20:23, Bin Meng  wrote:
> On Mon, Oct 19, 2015 at 5:55 AM, Simon Glass  wrote:
>> The current check is incorrect and will fail when any non-zero byte is read.
>> Fix it.
>>
>> Signed-off-by: Simon Glass 
>> ---
>>
>>  drivers/rtc/rtc-uclass.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/rtc/rtc-uclass.c b/drivers/rtc/rtc-uclass.c
>> index fe74c69..300e9b3 100644
>> --- a/drivers/rtc/rtc-uclass.c
>> +++ b/drivers/rtc/rtc-uclass.c
>> @@ -68,7 +68,7 @@ int rtc_read32(struct udevice *dev, unsigned int reg, u32 
>> *valuep)
>>
>> for (i = 0; i < sizeof(value); i++) {
>> ret = rtc_read8(dev, reg + i);
>> -   if (ret)
>> +   if (ret < 0)
>> return ret;
>> value |= ret << (i << 3);
>> }
>> --
>
> Reviewed-by: Bin Meng 

Applied to u-boot-x86.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 3/9] dm: rtc: Correct rtc_read32() return value

2015-10-18 Thread Simon Glass
The current check is incorrect and will fail when any non-zero byte is read.
Fix it.

Signed-off-by: Simon Glass 
---

 drivers/rtc/rtc-uclass.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/rtc/rtc-uclass.c b/drivers/rtc/rtc-uclass.c
index fe74c69..300e9b3 100644
--- a/drivers/rtc/rtc-uclass.c
+++ b/drivers/rtc/rtc-uclass.c
@@ -68,7 +68,7 @@ int rtc_read32(struct udevice *dev, unsigned int reg, u32 
*valuep)
 
for (i = 0; i < sizeof(value); i++) {
ret = rtc_read8(dev, reg + i);
-   if (ret)
+   if (ret < 0)
return ret;
value |= ret << (i << 3);
}
-- 
2.6.0.rc2.230.g3dd15c0

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 3/9] dm: rtc: Correct rtc_read32() return value

2015-10-18 Thread Bin Meng
On Mon, Oct 19, 2015 at 5:55 AM, Simon Glass  wrote:
> The current check is incorrect and will fail when any non-zero byte is read.
> Fix it.
>
> Signed-off-by: Simon Glass 
> ---
>
>  drivers/rtc/rtc-uclass.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/rtc/rtc-uclass.c b/drivers/rtc/rtc-uclass.c
> index fe74c69..300e9b3 100644
> --- a/drivers/rtc/rtc-uclass.c
> +++ b/drivers/rtc/rtc-uclass.c
> @@ -68,7 +68,7 @@ int rtc_read32(struct udevice *dev, unsigned int reg, u32 
> *valuep)
>
> for (i = 0; i < sizeof(value); i++) {
> ret = rtc_read8(dev, reg + i);
> -   if (ret)
> +   if (ret < 0)
> return ret;
> value |= ret << (i << 3);
> }
> --

Reviewed-by: Bin Meng 
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot