From: Lukas Wunner <lukas@wunner.de>
To: Marcel Holtmann <marcel@holtmann.org>,
Johan Hedberg <johan.hedberg@gmail.com>
Cc: Mika Westerberg <mika.westerberg@linux.intel.com>,
Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
Frederic Danis <frederic.danis.oss@gmail.com>,
Loic Poulain <loic.poulain@linaro.org>,
Hans de Goede <hdegoede@redhat.com>, Max Shavrick <mxms@me.com>,
Leif Liddy <leif.liddy@gmail.com>,
Daniel Roschka <danielroschka@phoenitydawn.de>,
Ronald Tschalaer <ronald@innovation.ch>,
"Peter Y. Chuang" <peteryuchuang@gmail.com>,
linux-bluetooth@vger.kernel.org
Subject: Re: [PATCH v3 09/13] Bluetooth: hci_bcm: Handle errors properly
Date: Mon, 8 Jan 2018 05:06:58 +0100 [thread overview]
Message-ID: <20180108040658.GA13972@wunner.de> (raw)
In-Reply-To: <4cf1ba614b554d096448d3705e95140fac346193.1515348092.git.lukas@wunner.de>
On Sun, Jan 07, 2018 at 08:16:32PM +0100, Lukas Wunner wrote:
> @@ -406,8 +440,10 @@ static int bcm_close(struct hci_uart *hu)
> device_init_wakeup(bdev->dev, false);
> }
>
> - bcm_gpio_set_power(bdev, false);
> - if (bdev->irq > 0) {
> + err = bcm_gpio_set_power(bdev, false);
> + if (err) {
> + bt_dev_err(hu->hdev, "Failed to power down");
> + } else if (bdev->irq > 0) {
> pm_runtime_disable(bdev->dev);
> pm_runtime_set_suspended(bdev->dev);
> }
Hm, I realize I've botched this (again): If a valid IRQ was found
but bcm_gpio_set_power() fails here, then the pm_runtime_enable()
in bcm_request_irq() isn't balanced. :-(
So pm_runtime_disable() needs to be called even if err != 0
(but only if bdev->irq > 0).
Lukas
next prev parent reply other threads:[~2018-01-08 4:06 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-07 19:16 [PATCH v3 00/13] Bluetooth on 2015+ MacBook (Pro) Lukas Wunner
2018-01-07 19:16 ` [PATCH v3 02/13] Bluetooth: hci_bcm: Validate IRQ before using it Lukas Wunner
2018-01-07 19:16 ` [PATCH v3 12/13] Bluetooth: hci_bcm: Sleep instead of spinning Lukas Wunner
2018-01-07 19:16 ` [PATCH v3 01/13] Bluetooth: hci_bcm: Mandate presence of shutdown and device wake GPIO Lukas Wunner
2018-01-07 19:16 ` [PATCH v3 08/13] Bluetooth: hci_bcm: Add callbacks to toggle GPIOs Lukas Wunner
2018-01-07 19:16 ` [PATCH v3 03/13] Bluetooth: hci_bcm: Clean up unnecessary #ifdef Lukas Wunner
2018-01-07 19:16 ` [PATCH v3 10/13] Bluetooth: hci_bcm: Support Apple GPIO handling Lukas Wunner
2018-01-08 13:19 ` Andy Shevchenko
2018-01-07 19:16 ` [PATCH v3 05/13] Bluetooth: hci_bcm: Fix unbalanced pm_runtime_disable() Lukas Wunner
2018-01-07 19:16 ` [PATCH v3 04/13] Bluetooth: hci_bcm: Fix race on close Lukas Wunner
2018-01-07 19:16 ` [PATCH v3 11/13] Bluetooth: hci_bcm: Silence IRQ printk Lukas Wunner
2018-01-07 19:16 ` [PATCH v3 06/13] Bluetooth: hci_bcm: Invalidate IRQ on request failure Lukas Wunner
2018-01-07 19:16 ` [PATCH v3 07/13] Bluetooth: hci_bcm: Document struct bcm_device Lukas Wunner
2018-01-08 4:27 ` Lukas Wunner
2018-01-07 19:16 ` [PATCH v3 09/13] Bluetooth: hci_bcm: Handle errors properly Lukas Wunner
2018-01-08 4:06 ` Lukas Wunner [this message]
2018-01-07 19:16 ` [PATCH v3 13/13] Bluetooth: btbcm: Fix sleep mode struct ordering Lukas Wunner
2018-01-08 13:28 ` [PATCH v3 00/13] Bluetooth on 2015+ MacBook (Pro) Andy Shevchenko
2018-01-10 14:03 ` 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=20180108040658.GA13972@wunner.de \
--to=lukas@wunner.de \
--cc=andriy.shevchenko@linux.intel.com \
--cc=danielroschka@phoenitydawn.de \
--cc=frederic.danis.oss@gmail.com \
--cc=hdegoede@redhat.com \
--cc=johan.hedberg@gmail.com \
--cc=leif.liddy@gmail.com \
--cc=linux-bluetooth@vger.kernel.org \
--cc=loic.poulain@linaro.org \
--cc=marcel@holtmann.org \
--cc=mika.westerberg@linux.intel.com \
--cc=mxms@me.com \
--cc=peteryuchuang@gmail.com \
--cc=ronald@innovation.ch \
/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;
as well as URLs for NNTP newsgroup(s).