Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp2429373ybg; Fri, 5 Jun 2020 13:49:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzFGxKivGLyrLCzdzQq8N77GqNsmFQhbyILXlW+PSd6iprYFRoiUffAkZzUEuFjKmP6W7vo X-Received: by 2002:a17:906:470b:: with SMTP id y11mr10762856ejq.182.1591390158264; Fri, 05 Jun 2020 13:49:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591390158; cv=none; d=google.com; s=arc-20160816; b=xFqi2lNvDNPKSWJQg7fkbKIGK+g1QdHCOG0nTD1RWAubF7LiwyiKbjwCKH22UCLkm+ xdfpqgNNsdJJ4upX38Xw67qnaW+a0dTNIDV+/g1gvQGfy8WlmDaCnUH5Z9EX+w/ldlRF CDwnsIb4j61/Hily4039oKzlgSpSXD1hPQkl2ZXFsule+2UFtzhsP7/1xs+wVM8Pcv81 6UbXUcj9PHiij5uwWUDOM01utS1RoDaUNYG0rjEJUKoxG3e8rQW3qWHV/0kKY1bykNNf 5lmCmfg9iky+nnYa4l9TUFs2jZa55qzWFq7StuGWSjAVdFpEDciaN8D7VX3Zj5CIxUUf bwPA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=Ll0PhFEEUTtkvVztwUOqDKrEYj1MeKb57EDVkpcBKeg=; b=FUelGLF0i8BTygB18r1tEBUwYaTOLwN9HoKRX/d7qNQVUiDVqcfcJxuYAl1+Vv2I2x O488b2HfcI2PEuvzohpPdV1kKtQFDc9Lov6Y9eTMNaJlEmXAOwrb6KiGQ09u7kFs77TO 2J5h05xFtuzkoXwPUJf61QHx2IMF2TNSZkX5LWie4gXxkLPIS9SzEBnsF7mUonQ5pr4p x0wnR5zjGyB9uWhW7P8KBGZyHDWAERbRTOJzhnP5sSoAxOAziK6VUlcw53QExruqiWB4 w1sS2m3JlTc+olAflrI18+nXk3W5YhICL1HUqxEQMBF0nhz1PlXWivipkLwzgFAATRL4 cRgA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=TJvtCyE2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z3si4242232ejm.403.2020.06.05.13.48.55; Fri, 05 Jun 2020 13:49:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=TJvtCyE2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728347AbgFEUq1 (ORCPT + 99 others); Fri, 5 Jun 2020 16:46:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53394 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726359AbgFEUq1 (ORCPT ); Fri, 5 Jun 2020 16:46:27 -0400 Received: from mail-vs1-xe42.google.com (mail-vs1-xe42.google.com [IPv6:2607:f8b0:4864:20::e42]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7DD8BC08C5C2 for ; Fri, 5 Jun 2020 13:46:26 -0700 (PDT) Received: by mail-vs1-xe42.google.com with SMTP id q2so6364345vsr.1 for ; Fri, 05 Jun 2020 13:46:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=Ll0PhFEEUTtkvVztwUOqDKrEYj1MeKb57EDVkpcBKeg=; b=TJvtCyE2ecjCdcx3X/dVNdgsldQax+W5sKXzqPr/qzmoHBE/P0uxL5+oM+1mneIhCI tg4w7Zh9gAcssCxOnJqecVtM6HUTaOt2y7MD31kL4E/bGJhziuoCB4uCaN91Q6bWNCmk Maoon86nawMnyrLtbr/H7n0HmjnH0H5rAjXik= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=Ll0PhFEEUTtkvVztwUOqDKrEYj1MeKb57EDVkpcBKeg=; b=rJOS67EUvt6HL3dl5yimH4mba3JdWeZiIsBBMJRqOdQ35I4IVnGQn0lPshwM+T83lL 6HXxAF5KppgzwBrD6xAP+57Ps/9SXTqpKSdaki2hct+WBCxps3ndruHYZI6+J0cS7R4b kTxnqJvKPs1hPOxeOXTnjmTMoQsijwjNWDRZy+k0SqQSiAc0AMdQF44EVOAdG5pSgZBQ YB/k69IIoH8oazVHuxq8r6K5sei5Mz4/puX/xk6BbwBD2vtrM6ss9BxPUlYi2XXmXAex H1phHSyE6zHTV13T6IUWP3Wru+EJvN1gALmqPBL90l/TOXSQiCOLtykTxR0mJcUr+Z2Q HkUA== X-Gm-Message-State: AOAM5310/vILTs+/bKefODi0ADLbiqam0/Bc4EIFfxwBjFtSTVU/9wOr tnxJPr2jNeY0firzwkKNy1upgjSX9Ya+RGXtqI4TWg== X-Received: by 2002:a67:3c6:: with SMTP id 189mr9191609vsd.71.1591389985717; Fri, 05 Jun 2020 13:46:25 -0700 (PDT) MIME-Version: 1.0 References: <20200605184611.252218-1-mka@chromium.org> <20200605114552.3.Ib9b5e6e81ea31cdc964cd0562ef4985a6c6c5154@changeid> In-Reply-To: <20200605114552.3.Ib9b5e6e81ea31cdc964cd0562ef4985a6c6c5154@changeid> From: Abhishek Pandit-Subedi Date: Fri, 5 Jun 2020 13:46:11 -0700 Message-ID: Subject: Re: [PATCH 3/3] Bluetooth: hci_qca: Refactor error handling in qca_suspend() To: Matthias Kaehlcke Cc: Marcel Holtmann , Johan Hedberg , Bluez mailing list , Rocky Liao , Zijun Hu , LKML , Balakrishna Godavarthi , Claire Chang Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Reviewed-by: Abhishek Pandit-Subedi On Fri, Jun 5, 2020 at 11:46 AM Matthias Kaehlcke wrote: > > 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 > --- > > 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 >