[PATCH 2/2] Staging: rtl8723bs: os_dep: Invert if selection statement

From: Guilherme T Maeoka
Date: Tue Mar 12 2019 - 10:39:58 EST


From: Guilherme T Maeoka <gui.maeoka@xxxxxxxxx>

Change 'if (a)' to 'if (!a)' and return. Otherwise, continue with
the previouly wrapped block of control. This reduces the indentation
level by 2 and 1.

I'm not if this commit contributes to the coding style.

Signed-off-by: Guilherme T Maeoka <gui.maeoka@xxxxxxxxx>
---
drivers/staging/rtl8723bs/os_dep/sdio_intf.c | 73 +++++++++++---------
1 file changed, 40 insertions(+), 33 deletions(-)

diff --git a/drivers/staging/rtl8723bs/os_dep/sdio_intf.c b/drivers/staging/rtl8723bs/os_dep/sdio_intf.c
index 86f1e090436e..54425ad28bfd 100644
--- a/drivers/staging/rtl8723bs/os_dep/sdio_intf.c
+++ b/drivers/staging/rtl8723bs/os_dep/sdio_intf.c
@@ -103,23 +103,27 @@ static void sdio_free_irq(struct dvobj_priv *dvobj)
struct sdio_func *func;
int err;

- if (dvobj->irq_alloc) {
- psdio_data = &dvobj->intf_data;
- func = psdio_data->func;
-
- if (func) {
- sdio_claim_host(func);
- err = sdio_release_irq(func);
- if (err) {
- dvobj->drv_dbg.dbg_sdio_free_irq_error_cnt++;
- DBG_871X_LEVEL(_drv_err_, "%s: sdio_release_irq FAIL(%d)!\n", __func__, err);
- } else {
- dvobj->drv_dbg.dbg_sdio_free_irq_cnt++;
- }
- sdio_release_host(func);
- }
- dvobj->irq_alloc = 0;
+ if (!dvobj->irq_alloc)
+ return;
+
+ psdio_data = &dvobj->intf_data;
+ func = psdio_data->func;
+ dvobj->irq_alloc = 0;
+
+ if (!func)
+ return;
+
+ sdio_claim_host(func);
+ err = sdio_release_irq(func);
+ if (err) {
+ dvobj->drv_dbg.dbg_sdio_free_irq_error_cnt++;
+ DBG_871X_LEVEL(_drv_err_, "%s: sdio_release_irq FAIL(%d)!\n",
+ __func__, err);
+ } else {
+ dvobj->drv_dbg.dbg_sdio_free_irq_cnt++;
}
+
+ sdio_release_host(func);
}

#ifdef CONFIG_GPIO_WAKEUP
@@ -219,26 +223,29 @@ static void sdio_deinit(struct dvobj_priv *dvobj)

func = dvobj->intf_data.func;

- if (func) {
- sdio_claim_host(func);
- err = sdio_disable_func(func);
- if (err) {
- dvobj->drv_dbg.dbg_sdio_deinit_error_cnt++;
- DBG_8192C(KERN_ERR "%s: sdio_disable_func(%d)\n", __func__, err);
- }
+ if (!func)
+ return;

- if (dvobj->irq_alloc) {
- err = sdio_release_irq(func);
- if (err) {
- dvobj->drv_dbg.dbg_sdio_free_irq_error_cnt++;
- DBG_8192C(KERN_ERR "%s: sdio_release_irq(%d)\n", __func__, err);
- } else {
- dvobj->drv_dbg.dbg_sdio_free_irq_cnt++;
- }
- }
+ sdio_claim_host(func);
+ err = sdio_disable_func(func);
+ if (err) {
+ dvobj->drv_dbg.dbg_sdio_deinit_error_cnt++;
+ DBG_8192C(KERN_ERR "%s: sdio_disable_func(%d)\n",
+ __func__, err);
+ }

- sdio_release_host(func);
+ if (dvobj->irq_alloc) {
+ err = sdio_release_irq(func);
+ if (err) {
+ dvobj->drv_dbg.dbg_sdio_free_irq_error_cnt++;
+ DBG_8192C(KERN_ERR "%s: sdio_release_irq(%d)\n",
+ __func__, err);
+ } else {
+ dvobj->drv_dbg.dbg_sdio_free_irq_cnt++;
+ }
}
+
+ sdio_release_host(func);
}

static struct dvobj_priv *sdio_dvobj_init(struct sdio_func *func)
--
2.17.1