mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Markus Elfring <Markus.Elfring@web.de>
To: ath10k@lists.infradead.org, linux-wireless@vger.kernel.org,
	Erik Stromdahl <erik.stromdahl@gmail.com>,
	Jeff Johnson <jjohnson@kernel.org>, Kalle Valo <kvalo@kernel.org>
Cc: LKML <linux-kernel@vger.kernel.org>,
	Julia Lawall <julia.lawall@inria.fr>
Subject: [PATCH] ath10k: Use sdio_release_host() call only once in two functions
Date: Fri, 20 Sep 2024 15:45:08 +0200	[thread overview]
Message-ID: <6ec0735e-d735-45e0-9d6c-e79fe3a11a21@web.de> (raw)

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Fri, 20 Sep 2024 15:36:19 +0200

A sdio_release_host() call was immediately used after a return code check
in two function implementations.
Thus use such a function call only once instead directly before the checks.

This issue was transformed by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/net/wireless/ath/ath10k/sdio.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/sdio.c b/drivers/net/wireless/ath/ath10k/sdio.c
index 08a6f36a6be9..432dee87d73b 100644
--- a/drivers/net/wireless/ath/ath10k/sdio.c
+++ b/drivers/net/wireless/ath/ath10k/sdio.c
@@ -1589,14 +1589,12 @@ static int ath10k_sdio_hif_power_up(struct ath10k *ar,
 	sdio_claim_host(func);

 	ret = sdio_enable_func(func);
+	sdio_release_host(func);
 	if (ret) {
 		ath10k_warn(ar, "unable to enable sdio function: %d)\n", ret);
-		sdio_release_host(func);
 		return ret;
 	}

-	sdio_release_host(func);
-
 	/* Wait for hardware to initialise. It should take a lot less than
 	 * 20 ms but let's be conservative here.
 	 */
@@ -1884,14 +1882,12 @@ static int ath10k_sdio_hif_start(struct ath10k *ar)

 	/* Register the isr */
 	ret =  sdio_claim_irq(ar_sdio->func, ath10k_sdio_irq_handler);
+	sdio_release_host(ar_sdio->func);
 	if (ret) {
 		ath10k_warn(ar, "failed to claim sdio interrupt: %d\n", ret);
-		sdio_release_host(ar_sdio->func);
 		return ret;
 	}

-	sdio_release_host(ar_sdio->func);
-
 	ret = ath10k_sdio_enable_intrs(ar);
 	if (ret)
 		ath10k_warn(ar, "failed to enable sdio interrupts: %d\n", ret);
--
2.46.0


                 reply	other threads:[~2024-09-20 13:45 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=6ec0735e-d735-45e0-9d6c-e79fe3a11a21@web.de \
    --to=markus.elfring@web.de \
    --cc=ath10k@lists.infradead.org \
    --cc=erik.stromdahl@gmail.com \
    --cc=jjohnson@kernel.org \
    --cc=julia.lawall@inria.fr \
    --cc=kvalo@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@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

all inboxes | Powered by JetHome®