mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] Staging: bcm: Bcmchar.c: remove else statement after return
@ 2014-07-29  0:09 Murilo Opsfelder Araujo
  2014-07-29  1:59 ` Joe Perches
  0 siblings, 1 reply; 2+ messages in thread
From: Murilo Opsfelder Araujo @ 2014-07-29  0:09 UTC (permalink / raw)
  To: devel, linux-kernel; +Cc: gregkh, klmckinney1, mail, Murilo Opsfelder Araujo

This patch makes checkpatch.pl script happier by fixing all warnings
related to else statement after break or return.

Signed-off-by: Murilo Opsfelder Araujo <mopsfelder@gmail.com>
---
 drivers/staging/bcm/Bcmchar.c |   21 ++++++++++-----------
 1 file changed, 10 insertions(+), 11 deletions(-)

diff --git a/drivers/staging/bcm/Bcmchar.c b/drivers/staging/bcm/Bcmchar.c
index c1e01f7..5790627 100644
--- a/drivers/staging/bcm/Bcmchar.c
+++ b/drivers/staging/bcm/Bcmchar.c
@@ -561,10 +561,10 @@ static int bcm_char_ioctl_gpio_set_request(void __user *argp,
 		BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, OSAL_DBG, DBG_LVL_ALL,
 				"GPIO_MODE_REGISTER read failed");
 		return Status;
-	} else {
-		Status = STATUS_SUCCESS;
 	}
 
+	Status = STATUS_SUCCESS;
+
 	/* Set the gpio mode register to output */
 	*(UINT *)ucResetValue |= (1<<uiBit);
 	Status = wrmaltWithLock(Adapter, GPIO_MODE_REGISTER,
@@ -669,10 +669,10 @@ static int bcm_char_ioctl_gpio_status_request(void __user *argp,
 		Status = bytes;
 		BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0,
 				"RDM Failed\n");
-		return Status;
 	} else {
 		Status = STATUS_SUCCESS;
 	}
+
 	return Status;
 }
 
@@ -763,10 +763,10 @@ static int bcm_char_ioctl_gpio_multi_request(void __user *argp,
 			BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0,
 					"RDM to GPIO_PIN_STATE_REGISTER Failed.");
 			return Status;
-		} else {
-			Status = STATUS_SUCCESS;
 		}
 
+		Status = STATUS_SUCCESS;
+
 		pgpio_multi_info[WIMAX_IDX].uiGPIOValue =
 			(*(UINT *)ucResetValue &
 			pgpio_multi_info[WIMAX_IDX].uiGPIOMask);
@@ -819,10 +819,10 @@ static int bcm_char_ioctl_gpio_mode_request(void __user *argp,
 		BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0,
 			"Read of GPIO_MODE_REGISTER failed");
 		return Status;
-	} else {
-		Status = STATUS_SUCCESS;
 	}
 
+	Status = STATUS_SUCCESS;
+
 	/* Validating the request */
 	if (IsReqGpioIsLedInNVM(Adapter, pgpio_multi_mode[WIMAX_IDX].uiGPIOMask)
 			== false) {
@@ -1076,11 +1076,11 @@ static int bcm_char_ioctl_buffer_download_stop(void __user *argp,
 		up(&Adapter->fw_download_sema);
 		up(&Adapter->NVMRdmWrmLock);
 		return Status;
-	} else {
-		BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, OSAL_DBG,
-				DBG_LVL_ALL, "Firm Download Over...\n");
 	}
 
+	BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, OSAL_DBG,
+			DBG_LVL_ALL, "Firm Download Over...\n");
+
 	mdelay(10);
 
 	/* Wait for MailBox Interrupt */
@@ -2649,4 +2649,3 @@ void unregister_control_device_interface(struct bcm_mini_adapter *Adapter)
 		unregister_chrdev(Adapter->major, DEV_NAME);
 	}
 }
-
-- 
1.7.10.4


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

* Re: [PATCH] Staging: bcm: Bcmchar.c: remove else statement after return
  2014-07-29  0:09 [PATCH] Staging: bcm: Bcmchar.c: remove else statement after return Murilo Opsfelder Araujo
@ 2014-07-29  1:59 ` Joe Perches
  0 siblings, 0 replies; 2+ messages in thread
From: Joe Perches @ 2014-07-29  1:59 UTC (permalink / raw)
  To: Murilo Opsfelder Araujo; +Cc: devel, linux-kernel, gregkh, klmckinney1, mail

On Mon, 2014-07-28 at 21:09 -0300, Murilo Opsfelder Araujo wrote:
> This patch makes checkpatch.pl script happier by fixing all warnings
> related to else statement after break or return.
[]
> diff --git a/drivers/staging/bcm/Bcmchar.c b/drivers/staging/bcm/Bcmchar.c
[]
> @@ -561,10 +561,10 @@ static int bcm_char_ioctl_gpio_set_request(void __user *argp,
>  		BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, OSAL_DBG, DBG_LVL_ALL,
>  				"GPIO_MODE_REGISTER read failed");
>  		return Status;
> -	} else {
> -		Status = STATUS_SUCCESS;
>  	}
>  
> +	Status = STATUS_SUCCESS;

This set of Status is unnecessary

>  	/* Set the gpio mode register to output */
>  	*(UINT *)ucResetValue |= (1<<uiBit);
>  	Status = wrmaltWithLock(Adapter, GPIO_MODE_REGISTER,

as it's immediately overwritten.

> @@ -669,10 +669,10 @@ static int bcm_char_ioctl_gpio_status_request(void __user *argp,
>  		Status = bytes;
>  		BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0,
>  				"RDM Failed\n");
> -		return Status;
>  	} else {
>  		Status = STATUS_SUCCESS;
>  	}
> +
>  	return Status;

	return STATUS_SUCCESS;


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

end of thread, other threads:[~2014-07-29  1:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-07-29  0:09 [PATCH] Staging: bcm: Bcmchar.c: remove else statement after return Murilo Opsfelder Araujo
2014-07-29  1:59 ` Joe Perches

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome