All of lore.kernel.org
 help / color / mirror / Atom feed
From: Matthias Kaehlcke <mka@chromium.org>
To: Marcel Holtmann <marcel@holtmann.org>,
	Johan Hedberg <johan.hedberg@gmail.com>
Cc: linux-bluetooth@vger.kernel.org,
	Rocky Liao <rjliao@codeaurora.org>,
	Zijun Hu <zijuhu@codeaurora.org>,
	linux-kernel@vger.kernel.org,
	Balakrishna Godavarthi <bgodavar@codeaurora.org>,
	Abhishek Pandit-Subedi <abhishekpandit@chromium.org>,
	Claire Chang <tientzu@chromium.org>,
	Matthias Kaehlcke <mka@chromium.org>
Subject: [PATCH 3/3] Bluetooth: hci_qca: Refactor error handling in qca_suspend()
Date: Fri,  5 Jun 2020 11:46:11 -0700	[thread overview]
Message-ID: <20200605114552.3.Ib9b5e6e81ea31cdc964cd0562ef4985a6c6c5154@changeid> (raw)
In-Reply-To: <20200605184611.252218-1-mka@chromium.org>

If waiting for IBS sleep times out jump to the error handler, this is
easier to read than multiple 'if' branches and a fall through to the
error handler.

Signed-off-by: Matthias Kaehlcke <mka@chromium.org>
---

 drivers/bluetooth/hci_qca.c | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/drivers/bluetooth/hci_qca.c b/drivers/bluetooth/hci_qca.c
index 90ffd8ca1fb0d..cf76f128e9834 100644
--- a/drivers/bluetooth/hci_qca.c
+++ b/drivers/bluetooth/hci_qca.c
@@ -2109,18 +2109,16 @@ static int __maybe_unused qca_suspend(struct device *dev)
 	/* Wait for HCI_IBS_SLEEP_IND sent by device to indicate its Tx is going
 	 * to sleep, so that the packet does not wake the system later.
 	 */
-
 	ret = wait_event_interruptible_timeout(qca->suspend_wait_q,
 			qca->rx_ibs_state == HCI_IBS_RX_ASLEEP,
 			msecs_to_jiffies(IBS_BTSOC_TX_IDLE_TIMEOUT_MS));
-
-	if (ret > 0) {
-		qca_wq_serial_tx_clock_vote_off(&qca->ws_tx_vote_off);
-		return 0;
+	if (ret == 0) {
+		ret = -ETIMEDOUT;
+		goto error;
 	}
 
-	if (ret == 0)
-		ret = -ETIMEDOUT;
+	qca_wq_serial_tx_clock_vote_off(&qca->ws_tx_vote_off);
+	return 0;
 
 error:
 	clear_bit(QCA_SUSPENDING, &qca->flags);
-- 
2.27.0.278.ge193c7cf3a9-goog


  parent reply	other threads:[~2020-06-05 18:46 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-05 18:46 [PATCH 0/3] Matthias Kaehlcke
2020-06-05 18:46 ` [PATCH 1/3] Bluetooth: hci_qca: Only remove TX clock vote after TX is completed Matthias Kaehlcke
2020-06-05 20:44   ` Abhishek Pandit-Subedi
2020-06-06 12:53   ` bgodavar
2020-06-06 15:26     ` Matthias Kaehlcke
2020-06-08  8:11   ` Marcel Holtmann
2020-06-05 18:46 ` [PATCH 2/3] Bluetooth: hci_qca: Skip serdev wait when no transfer is pending Matthias Kaehlcke
2020-06-05 20:45   ` Abhishek Pandit-Subedi
2020-06-06 12:57   ` bgodavar
2020-06-06 14:42     ` Matthias Kaehlcke
2020-06-08  8:13   ` Marcel Holtmann
2020-06-05 18:46 ` Matthias Kaehlcke [this message]
2020-06-05 20:46   ` [PATCH 3/3] Bluetooth: hci_qca: Refactor error handling in qca_suspend() Abhishek Pandit-Subedi
2020-06-08  8:14   ` Marcel Holtmann

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=20200605114552.3.Ib9b5e6e81ea31cdc964cd0562ef4985a6c6c5154@changeid \
    --to=mka@chromium.org \
    --cc=abhishekpandit@chromium.org \
    --cc=bgodavar@codeaurora.org \
    --cc=johan.hedberg@gmail.com \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marcel@holtmann.org \
    --cc=rjliao@codeaurora.org \
    --cc=tientzu@chromium.org \
    --cc=zijuhu@codeaurora.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.