Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1417441 > unrolled thread

[PATCH] staging: slicoss: replacement of goto statements

Started byJaime Arrocha <jarr@innercoder.com>
First post2016-06-08 15:50 +0200
Last post2016-06-08 19:20 +0200
Articles 4 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] staging: slicoss: replacement of goto statements Jaime Arrocha <jarr@innercoder.com> - 2016-06-08 15:50 +0200
    Re: [PATCH] staging: slicoss: replacement of goto statements Greg KH <gregkh@linuxfoundation.org> - 2016-06-08 17:50 +0200
      Re: Re: [PATCH] staging: slicoss: replacement of goto statements Jaime Arrocha <jarr@innercoder.com> - 2016-06-08 18:30 +0200
        Re: Re: [PATCH] staging: slicoss: replacement of goto statements Greg KH <gregkh@linuxfoundation.org> - 2016-06-08 19:20 +0200

#1417441 — [PATCH] staging: slicoss: replacement of goto statements

FromJaime Arrocha <jarr@innercoder.com>
Date2016-06-08 15:50 +0200
Subject[PATCH] staging: slicoss: replacement of goto statements
Message-ID<rHM1Q-Pq-9@gated-at.bofh.it>
From: Jaime Arrocha <jarr@innercoder.com>

Replaced deprecated goto statements.

Signed-off-by: Jaime Arrocha <jarr@innercoder.com>
---
 drivers/staging/slicoss/slicoss.c | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/drivers/staging/slicoss/slicoss.c b/drivers/staging/slicoss/slicoss.c
index ac126d4..cc45f4c 100644
--- a/drivers/staging/slicoss/slicoss.c
+++ b/drivers/staging/slicoss/slicoss.c
@@ -1457,30 +1457,30 @@ static struct slic_hostcmd *slic_cmdq_getfree(struct adapter *adapter)
 	struct slic_hostcmd *cmd = NULL;
 	unsigned long flags;
 
-lock_and_retry:
 	spin_lock_irqsave(&cmdq->lock, flags);
-retry:
 	cmd = cmdq->head;
-	if (cmd) {
-		cmdq->head = cmd->next;
-		cmdq->count--;
-		spin_unlock_irqrestore(&cmdq->lock, flags);
-	} else {
+	while (!cmd) {
 		slic_cmdq_getdone(adapter);
 		cmd = cmdq->head;
-		if (cmd) {
-			goto retry;
-		} else {
+		if (cmd)
+			continue;
+		else {
 			u32 *pageaddr;
 
 			spin_unlock_irqrestore(&cmdq->lock, flags);
 			pageaddr = slic_cmdqmem_addpage(adapter);
 			if (pageaddr) {
 				slic_cmdq_addcmdpage(adapter, pageaddr);
-				goto lock_and_retry;
+				spin_lock_irqsave(&cmdq->lock, flags);
+				cmd = cmdq->head;
+				continue;
 			}
+			return cmd;
 		}
 	}
+	cmdq->head = cmd->next;
+	cmdq->count--;
+	spin_unlock_irqrestore(&cmdq->lock, flags);
 	return cmd;
 }
 
-- 
2.1.4

[toc] | [next] | [standalone]


#1417600

FromGreg KH <gregkh@linuxfoundation.org>
Date2016-06-08 17:50 +0200
Message-ID<rHNTY-21z-11@gated-at.bofh.it>
In reply to#1417441
On Wed, Jun 08, 2016 at 08:46:06AM -0500, Jaime Arrocha wrote:
> From: Jaime Arrocha <jarr@innercoder.com>
> 
> Replaced deprecated goto statements.

Since when is 'goto' deprecated?

Were you able to test these changes?

thanks,

greg k-h

[toc] | [prev] | [next] | [standalone]


#1417647

FromJaime Arrocha <jarr@innercoder.com>
Date2016-06-08 18:30 +0200
Message-ID<rHOwG-2ud-3@gated-at.bofh.it>
In reply to#1417600
---- On Wed, 08 Jun 2016 10:49:47 -0500 Greg KH <gregkh@linuxfoundation.org> wrote ---- 

 > On Wed, Jun 08, 2016 at 08:46:06AM -0500, Jaime Arrocha wrote: 
 > > From: Jaime Arrocha <jarr@innercoder.com> 
 > >  
 > > Replaced deprecated goto statements. 
 >  
 > Since when is 'goto' deprecated? 
 >  
 > Were you able to test these changes? 
 >  
 > thanks, 
 >  
 > greg k-h 
 > 
 > 

Just wanted to see your stance on this type of changes. The documentation says "deprecated by some people".

I didn't test the changes. But it compiled and logically tested possible outcomes.

Not good enough? :)

Thanks,

Jaime A.

[toc] | [prev] | [next] | [standalone]


#1417706

FromGreg KH <gregkh@linuxfoundation.org>
Date2016-06-08 19:20 +0200
Message-ID<rHPj4-30z-1@gated-at.bofh.it>
In reply to#1417647
On Wed, Jun 08, 2016 at 11:28:11AM -0500, Jaime Arrocha wrote:
> 
> ---- On Wed, 08 Jun 2016 10:49:47 -0500 Greg KH <gregkh@linuxfoundation.org> wrote ---- 
> 
>  > On Wed, Jun 08, 2016 at 08:46:06AM -0500, Jaime Arrocha wrote: 
>  > > From: Jaime Arrocha <jarr@innercoder.com> 
>  > >  
>  > > Replaced deprecated goto statements. 
>  >  
>  > Since when is 'goto' deprecated? 
>  >  
>  > Were you able to test these changes? 
>  >  
>  > thanks, 
>  >  
>  > greg k-h 
>  > 
>  > 
> 
> Just wanted to see your stance on this type of changes. The
> documentation says "deprecated by some people".

What documentation?  And what people?

> I didn't test the changes. But it compiled and logically tested
> possible outcomes.
> 
> Not good enough? :)

Nope, sorry, churn for churn's sake isn't acceptable.

greg k-h

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web