[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <46d39974-05ae-193a-7602-556fbf28fa48@gmail.com>
Date: Thu, 19 May 2022 08:48:58 +0300
From: Pavel Skripkin <paskripkin@...il.com>
To: Dan Carpenter <dan.carpenter@...cle.com>
Cc: gregkh@...uxfoundation.org, Larry.Finger@...inger.net,
phil@...lpotter.co.uk, straube.linux@...il.com,
fmdefrancesco@...il.com, linux-kernel@...r.kernel.org,
linux-staging@...ts.linux.dev
Subject: Re: [PATCH 3/4] staging: r8188eu: add error handling of rtw_read32
Hi Dan,
On 5/19/22 08:43, Dan Carpenter wrote:
> On Thu, May 19, 2022 at 01:12:01AM +0300, Pavel Skripkin wrote:
>> diff --git a/drivers/staging/r8188eu/core/rtw_efuse.c b/drivers/staging/r8188eu/core/rtw_efuse.c
>> index a2691c7f96f6..7105122c2ba0 100644
>> --- a/drivers/staging/r8188eu/core/rtw_efuse.c
>> +++ b/drivers/staging/r8188eu/core/rtw_efuse.c
>> @@ -47,9 +47,18 @@ ReadEFuseByte(
>>
>> /* Check bit 32 read-ready */
>> retry = 0;
>> - value32 = rtw_read32(Adapter, EFUSE_CTRL);
>> - while (!(((value32 >> 24) & 0xff) & 0x80) && (retry < 10000)) {
>> - value32 = rtw_read32(Adapter, EFUSE_CTRL);
>> + res = rtw_read32(Adapter, EFUSE_CTRL, &value32);
>> + if (res)
>> + return;
>> +
>> + while (retry < 10000) {
>> + res = rtw_read32(Adapter, EFUSE_CTRL, &value32);
>> + if (res)
>> + continue;
>
> Forever loop. Always put the ++ in side the while (). Apparently,
> Smatch does not catch this. #Idea #Oppurtunity
>
I have missed it every single loop... :(
That's why I don't like 'while' loops, 'for' suits much better for this
kind of things.
Thanks you for your review! Will address your comments in next version
With regards,
Pavel Skripkin
Download attachment "OpenPGP_signature" of type "application/pgp-signature" (841 bytes)
Powered by blists - more mailing lists