From: Guilherme T Maeoka <gui.mspace@gmail.com>
To: gregkh@linuxfoundation.org
Cc: devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org,
Guilherme T Maeoka <gui.maeoka@gmail.com>
Subject: [PATCH 2/2] Staging: rtl8723bs: os_dep: Invert if selection statement
Date: Tue, 12 Mar 2019 11:39:14 -0300 [thread overview]
Message-ID: <20190312143914.4471-2-gui.mspace@gmail.com> (raw)
In-Reply-To: <20190312143914.4471-1-gui.mspace@gmail.com>
From: Guilherme T Maeoka <gui.maeoka@gmail.com>
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@gmail.com>
---
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
next prev parent reply other threads:[~2019-03-12 14:39 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-12 14:39 [PATCH 1/2] Staging: rtl8723bs: os_dep: Fix several coding style errors Guilherme T Maeoka
2019-03-12 14:39 ` Guilherme T Maeoka [this message]
2019-03-12 15:10 ` Dan Carpenter
2019-03-12 15:15 ` Guilherme M
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190312143914.4471-2-gui.mspace@gmail.com \
--to=gui.mspace@gmail.com \
--cc=devel@driverdev.osuosl.org \
--cc=gregkh@linuxfoundation.org \
--cc=gui.maeoka@gmail.com \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox