netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Fix an infinite retry-loop
@ 2015-01-04 18:04 Giel van Schijndel
  2015-01-04 23:04 ` Giel van Schijndel
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Giel van Schijndel @ 2015-01-04 18:04 UTC (permalink / raw)
  To: linux-kernel
  Cc: Giel van Schijndel, Jitendra Kalsaria, Ron Mercer,
	supporter:QLOGIC QLA3XXX NE..., open list:QLOGIC QLA3XXX NE...

This was clearly intended as a retry-10-times loop, but due to the
absence of code incrementing the loop-counter it was practically a
retry-forever loop.

Rewritten it as a for-loop as well to make the loop-counter increment
(as well as its potential absence) easier to spot.
---
 drivers/net/ethernet/qlogic/qla3xxx.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/qlogic/qla3xxx.c b/drivers/net/ethernet/qlogic/qla3xxx.c
index c2f09af..35a26c9 100644
--- a/drivers/net/ethernet/qlogic/qla3xxx.c
+++ b/drivers/net/ethernet/qlogic/qla3xxx.c
@@ -144,9 +144,9 @@ static int ql_sem_lock(struct ql3_adapter *qdev, u32 sem_mask, u32 sem_bits)
  */
 static int ql_wait_for_drvr_lock(struct ql3_adapter *qdev)
 {
-	int i = 0;
+	int i;
 
-	while (i < 10) {
+	for (i = 0; i < 10; ++i) {
 		if (i)
 			ssleep(1);
 
-- 
2.1.4

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

* Re: [PATCH] Fix an infinite retry-loop
  2015-01-04 18:04 [PATCH] Fix an infinite retry-loop Giel van Schijndel
@ 2015-01-04 23:04 ` Giel van Schijndel
  2015-01-05  4:48 ` David Miller
  2015-01-07 18:39 ` Andy Shevchenko
  2 siblings, 0 replies; 4+ messages in thread
From: Giel van Schijndel @ 2015-01-04 23:04 UTC (permalink / raw)
  To: linux-kernel
  Cc: Jitendra Kalsaria, Ron Mercer, supporter:QLOGIC QLA3XXX NE...,
	open list:QLOGIC QLA3XXX NE...

[-- Attachment #1: Type: text/plain, Size: 741 bytes --]

On Sun, Jan 04, 2015 at 19:04:55 +0100, Giel van Schijndel wrote:
> This was clearly intended as a retry-10-times loop, but due to the
> absence of code incrementing the loop-counter it was practically a
> retry-forever loop.
> 
> Rewritten it as a for-loop as well to make the loop-counter increment
> (as well as its potential absence) easier to spot.
> ---

Forgot to:
Signed-off-by: Giel van Schijndel <me@mortis.eu>

-- 
Met vriendelijke groet,
With kind regards,
Giel van Schijndel
--
"A computer is a stupid machine with the ability to do incredibly smart
 things, while computer programmers are smart people with the ability to
 do incredibly stupid things. They are, in short, a perfect match.
  -- Bill Bryson

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]

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

* Re: [PATCH] Fix an infinite retry-loop
  2015-01-04 18:04 [PATCH] Fix an infinite retry-loop Giel van Schijndel
  2015-01-04 23:04 ` Giel van Schijndel
@ 2015-01-05  4:48 ` David Miller
  2015-01-07 18:39 ` Andy Shevchenko
  2 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2015-01-05  4:48 UTC (permalink / raw)
  To: me; +Cc: linux-kernel, jitendra.kalsaria, ron.mercer, linux-driver, netdev

From: Giel van Schijndel <me@mortis.eu>
Date: Sun,  4 Jan 2015 19:04:55 +0100

> This was clearly intended as a retry-10-times loop, but due to the
> absence of code incrementing the loop-counter it was practically a
> retry-forever loop.
> 
> Rewritten it as a for-loop as well to make the loop-counter increment
> (as well as its potential absence) easier to spot.

Besides missing the Signoff, you also did not write your
Subject line properly.

You should format it as:

Subject: [PATCH] ${SUBSYSTEM_PREFIX}: Description.

Where ${SUBSYSTEM_PREFIX} should be "qlogic: " in this
case.

Do not fix this by replying to this email, instead make a new
fresh patch posting to the lists.

This also applied to all of your other submissions, they all
need to be fixed up in this manner at the very least.

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

* Re: [PATCH] Fix an infinite retry-loop
  2015-01-04 18:04 [PATCH] Fix an infinite retry-loop Giel van Schijndel
  2015-01-04 23:04 ` Giel van Schijndel
  2015-01-05  4:48 ` David Miller
@ 2015-01-07 18:39 ` Andy Shevchenko
  2 siblings, 0 replies; 4+ messages in thread
From: Andy Shevchenko @ 2015-01-07 18:39 UTC (permalink / raw)
  To: Giel van Schijndel
  Cc: linux-kernel@vger.kernel.org, Jitendra Kalsaria, Ron Mercer,
	supporter:QLOGIC QLA3XXX NE..., open list:QLOGIC QLA3XXX NE...

On Sun, Jan 4, 2015 at 8:04 PM, Giel van Schijndel <me@mortis.eu> wrote:
> This was clearly intended as a retry-10-times loop, but due to the
> absence of code incrementing the loop-counter it was practically a
> retry-forever loop.
>
> Rewritten it as a for-loop as well to make the loop-counter increment
> (as well as its potential absence) easier to spot.

It's already in upstream in better form.

> ---
>  drivers/net/ethernet/qlogic/qla3xxx.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/ethernet/qlogic/qla3xxx.c b/drivers/net/ethernet/qlogic/qla3xxx.c
> index c2f09af..35a26c9 100644
> --- a/drivers/net/ethernet/qlogic/qla3xxx.c
> +++ b/drivers/net/ethernet/qlogic/qla3xxx.c
> @@ -144,9 +144,9 @@ static int ql_sem_lock(struct ql3_adapter *qdev, u32 sem_mask, u32 sem_bits)
>   */
>  static int ql_wait_for_drvr_lock(struct ql3_adapter *qdev)
>  {
> -       int i = 0;
> +       int i;
>
> -       while (i < 10) {
> +       for (i = 0; i < 10; ++i) {
>                 if (i)
>                         ssleep(1);
>
> --
> 2.1.4
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/



-- 
With Best Regards,
Andy Shevchenko

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

end of thread, other threads:[~2015-01-07 18:39 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-01-04 18:04 [PATCH] Fix an infinite retry-loop Giel van Schijndel
2015-01-04 23:04 ` Giel van Schijndel
2015-01-05  4:48 ` David Miller
2015-01-07 18:39 ` Andy Shevchenko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).