All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pavel Skripkin <paskripkin@gmail.com>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: gregkh@linuxfoundation.org, Larry.Finger@lwfinger.net,
	phil@philpotter.co.uk, straube.linux@gmail.com,
	fmdefrancesco@gmail.com, linux-kernel@vger.kernel.org,
	linux-staging@lists.linux.dev
Subject: Re: [PATCH 3/4] staging: r8188eu: add error handling of rtw_read32
Date: Thu, 19 May 2022 08:48:58 +0300	[thread overview]
Message-ID: <46d39974-05ae-193a-7602-556fbf28fa48@gmail.com> (raw)
In-Reply-To: <20220519054356.GU4009@kadam>


[-- Attachment #1.1: Type: text/plain, Size: 1225 bytes --]

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

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]

  reply	other threads:[~2022-05-19  5:49 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-18 22:11 [PATCH 0/4] staging: r8188eu: add error handling of usb read errors Pavel Skripkin
2022-05-18 22:11 ` [PATCH 1/4] staging: r8188eu: add error handling of rtw_read8 Pavel Skripkin
2022-05-19  1:34   ` kernel test robot
2022-05-19  4:33   ` Dan Carpenter
2022-05-19  5:43     ` Pavel Skripkin
2022-05-19  5:49       ` Dan Carpenter
2022-05-18 22:11 ` [PATCH 2/4] staging: r8188eu: add error handling of rtw_read16 Pavel Skripkin
2022-05-19  4:47   ` Dan Carpenter
2022-05-18 22:12 ` [PATCH 3/4] staging: r8188eu: add error handling of rtw_read32 Pavel Skripkin
2022-05-19  5:43   ` Dan Carpenter
2022-05-19  5:48     ` Pavel Skripkin [this message]
2022-05-18 22:12 ` [PATCH 4/4] MAINTAINERS: add myself as r8188eu reviewer Pavel Skripkin
2022-05-19  5:46   ` Dan Carpenter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=46d39974-05ae-193a-7602-556fbf28fa48@gmail.com \
    --to=paskripkin@gmail.com \
    --cc=Larry.Finger@lwfinger.net \
    --cc=dan.carpenter@oracle.com \
    --cc=fmdefrancesco@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-staging@lists.linux.dev \
    --cc=phil@philpotter.co.uk \
    --cc=straube.linux@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.