LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Marcel Holtmann <marcel@holtmann.org>
To: Kangmin Park <l4stpr0gr4m@gmail.com>
Cc: Johan Hedberg <johan.hedberg@gmail.com>,
Luiz Augusto von Dentz <luiz.dentz@gmail.com>,
"David S. Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>,
Tedd Ho-Jeong An <tedd.an@intel.com>,
linux-bluetooth@vger.kernel.org, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3] Bluetooth: Fix return value in hci_dev_do_close()
Date: Thu, 19 Aug 2021 17:07:37 +0200 [thread overview]
Message-ID: <C0D6D79E-7325-4A7C-9153-FB35A88DD9CB@holtmann.org> (raw)
In-Reply-To: <20210817064411.2378-1-l4stpr0gr4m@gmail.com>
Hi Kangmin,
> hci_error_reset() return without calling hci_dev_do_open() when
> hci_dev_do_close() return error value which is not 0.
>
> Also, hci_dev_close() return hci_dev_do_close() function's return
> value.
>
> But, hci_dev_do_close() return always 0 even if hdev->shutdown
> return error value. So, fix hci_dev_do_close() to save and return
> the return value of the hdev->shutdown when it is called.
>
> Signed-off-by: Kangmin Park <l4stpr0gr4m@gmail.com>
> ---
> net/bluetooth/hci_core.c | 7 ++++---
> 1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
> index 8622da2d9395..84afc0d693a8 100644
> --- a/net/bluetooth/hci_core.c
> +++ b/net/bluetooth/hci_core.c
> @@ -1718,6 +1718,7 @@ static void hci_pend_le_actions_clear(struct hci_dev *hdev)
> int hci_dev_do_close(struct hci_dev *hdev)
> {
> bool auto_off;
> + int ret = 0;
>
> BT_DBG("%s %p", hdev->name, hdev);
>
> @@ -1732,13 +1733,13 @@ int hci_dev_do_close(struct hci_dev *hdev)
> test_bit(HCI_UP, &hdev->flags)) {
> /* Execute vendor specific shutdown routine */
> if (hdev->shutdown)
> - hdev->shutdown(hdev);
> + ret = hdev->shutdown(hdev);
> }
>
> if (!test_and_clear_bit(HCI_UP, &hdev->flags)) {
> cancel_delayed_work_sync(&hdev->cmd_timer);
> hci_req_sync_unlock(hdev);
> - return 0;
> + return ret;
> }
>
> hci_leds_update_powered(hdev, false);
> @@ -1845,7 +1846,7 @@ int hci_dev_do_close(struct hci_dev *hdev)
> hci_req_sync_unlock(hdev);
>
> hci_dev_put(hdev);
> - return 0;
> + return ret;
> }
actually use variable name err instead of ret since that is more consistent in this code.
Regards
Marcel
prev parent reply other threads:[~2021-08-19 15:07 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-17 6:44 Kangmin Park
2021-08-19 15:07 ` Marcel Holtmann [this message]
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=C0D6D79E-7325-4A7C-9153-FB35A88DD9CB@holtmann.org \
--to=marcel@holtmann.org \
--cc=davem@davemloft.net \
--cc=johan.hedberg@gmail.com \
--cc=kuba@kernel.org \
--cc=l4stpr0gr4m@gmail.com \
--cc=linux-bluetooth@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=luiz.dentz@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=tedd.an@intel.com \
--subject='Re: [PATCH v3] Bluetooth: Fix return value in hci_dev_do_close()' \
/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
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).