Skip to contentSkip to conversation

staging: slicoss: replacement of goto statements

PATCH In review Jaime Arrocha 2 participants 4 messages Jun 8, 2016 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 staging: slicoss: replacement of goto statements

From: Jaime Arrocha <[email protected]>

Replaced deprecated goto statements.

---
 drivers/staging/slicoss/slicoss.c | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)
drivers/staging/slicoss/slicoss.c +11 -11
index ac126d4..cc45f4c 100644
@@ -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;
 }
 
Signature · 1 line
2.1.4
maintainer
#1 lore raw
Quoted 3 lines · Jaime Arrocha

From: Jaime Arrocha <[email protected]>

Replaced deprecated goto statements.

Since when is 'goto' deprecated?

Were you able to test these changes?

thanks,

greg k-h

#2 lore raw

---- On Wed, 08 Jun 2016 10:49:47 -0500 Greg KH <[email protected]> wrote ----

Quoted 5 lines · Jaime Arrocha
Quoted 3 lines

From: Jaime Arrocha <[email protected]>

Replaced deprecated goto statements.

Quoted 9 lines

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.

maintainer
#3 lore raw
Quoted 12 lines · Jaime Arrocha

---- On Wed, 08 Jun 2016 10:49:47 -0500 Greg KH <[email protected]> wrote ----

Quoted 9 lines · Jaime Arrocha
Quoted 3 lines

From: Jaime Arrocha <[email protected]>

Replaced deprecated goto statements.

Since when is 'goto' deprecated?

Were you able to test these changes?

Quoted 8 lines
Quoted 5 lines

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?

Quoted 4 lines

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