linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] staging: slicoss: replacement of goto statements
@ 2016-06-08 13:46 Jaime Arrocha
  2016-06-08 15:49 ` Greg KH
  0 siblings, 1 reply; 4+ messages in thread
From: Jaime Arrocha @ 2016-06-08 13:46 UTC (permalink / raw)
  To: gregkh; +Cc: liodot, devel, linux-kernel, charrer, Jaime Arrocha

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

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

* Re: [PATCH] staging: slicoss: replacement of goto statements
  2016-06-08 13:46 [PATCH] staging: slicoss: replacement of goto statements Jaime Arrocha
@ 2016-06-08 15:49 ` Greg KH
  2016-06-08 16:28   ` Jaime Arrocha
  0 siblings, 1 reply; 4+ messages in thread
From: Greg KH @ 2016-06-08 15:49 UTC (permalink / raw)
  To: Jaime Arrocha; +Cc: devel, charrer, linux-kernel, liodot

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

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

* Re: Re: [PATCH] staging: slicoss: replacement of goto statements
  2016-06-08 15:49 ` Greg KH
@ 2016-06-08 16:28   ` Jaime Arrocha
  2016-06-08 17:13     ` Greg KH
  0 siblings, 1 reply; 4+ messages in thread
From: Jaime Arrocha @ 2016-06-08 16:28 UTC (permalink / raw)
  To: Greg KH; +Cc: devel, charrer, linux-kernel, liodot


---- 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.

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

* Re: Re: [PATCH] staging: slicoss: replacement of goto statements
  2016-06-08 16:28   ` Jaime Arrocha
@ 2016-06-08 17:13     ` Greg KH
  0 siblings, 0 replies; 4+ messages in thread
From: Greg KH @ 2016-06-08 17:13 UTC (permalink / raw)
  To: Jaime Arrocha; +Cc: devel, liodot, linux-kernel, charrer

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

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

end of thread, other threads:[~2016-06-08 17:13 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-08 13:46 [PATCH] staging: slicoss: replacement of goto statements Jaime Arrocha
2016-06-08 15:49 ` Greg KH
2016-06-08 16:28   ` Jaime Arrocha
2016-06-08 17:13     ` Greg KH

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).