[PATCH 09/11] staging: unisys: virthba: Fix "else not useful after return" warning

Ken Depro kenneth.depro at unisys.com
Tue Nov 18 18:18:36 UTC 2014


This patch fixes a warning generated during the checkpatch script that stated
"else not useful after return".  I modified the code to return a designated
status at the end of the function, and replaced the return statement in the
"else if" to set the status accordingly.

Signed-off-by: Ken Depro <kenneth.depro at unisys.com>
---
 drivers/staging/unisys/virthba/virthba.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/unisys/virthba/virthba.c b/drivers/staging/unisys/virthba/virthba.c
index dd361cd..c9110a8 100644
--- a/drivers/staging/unisys/virthba/virthba.c
+++ b/drivers/staging/unisys/virthba/virthba.c
@@ -1584,6 +1584,8 @@ virthba_serverdown_complete(struct work_struct *work)
 static int
 virthba_serverdown(struct virtpci_dev *virtpcidev, u32 state)
 {
+	int stat = 1;
+
 	struct virthba_info *virthbainfo =
 	    (struct virthba_info *)((struct Scsi_Host *)virtpcidev->scsi.
 				     scsihost)->hostdata;
@@ -1598,12 +1600,12 @@ virthba_serverdown(struct virtpci_dev *virtpcidev, u32 state)
 			   &virthbainfo->serverdown_completion);
 	} else if (virthbainfo->serverchangingstate) {
 		LOGERR("Server already processing change state message\n");
-		return 0;
+		stat = 0;
 	} else {
 		LOGERR("Server already down, but another server down message received.");
 	}
 
-	return 1;
+	return stat;
 }
 
 /*****************************************************/
-- 
1.7.9.5



More information about the devel mailing list