diff mbox series

[RFC,v2,08/31] timers: Bluetooth: Use del_timer_shutdown() before freeing timer

Message ID 20221027150926.587581591@goodmis.org (mailing list archive)
State New, archived
Headers show
Series None | expand

Checks

Context Check Description
tedd_an/pre-ci_am success Success
tedd_an/checkpatch success Checkpatch PASS
tedd_an/gitlint success Gitlint PASS
tedd_an/subjectprefix success PASS
tedd_an/buildkernel fail Build Kernel make FAIL: drivers/bluetooth/hci_bcsp.c: In function ‘bcsp_close’: drivers/bluetooth/hci_bcsp.c:740:2: error: implicit declaration of function ‘del_timer_shutdown’; did you mean ‘device_shutdown’? [-Werror=implicit-function-declaration] 740 | del_timer_shutdown(&bcsp->tbcsp); | ^~~~~~~~~~~~~~~~~~ | device_shutdown cc1: some warnings being treated as errors make[2]: *** [scripts/Makefile.build:249: drivers/bluetooth/hci_bcsp.o] Error 1 make[2]: *** Waiting for unfinished jobs.... make[1]: *** [scripts/Makefile.build:465: drivers/bluetooth] Error 2 make: *** [Makefile:1852: drivers] Error 2
tedd_an/buildkernel32 fail Build Kernel32 make FAIL: drivers/bluetooth/hci_bcsp.c: In function ‘bcsp_close’: drivers/bluetooth/hci_bcsp.c:740:2: error: implicit declaration of function ‘del_timer_shutdown’; did you mean ‘device_shutdown’? [-Werror=implicit-function-declaration] 740 | del_timer_shutdown(&bcsp->tbcsp); | ^~~~~~~~~~~~~~~~~~ | device_shutdown cc1: some warnings being treated as errors make[2]: *** [scripts/Makefile.build:249: drivers/bluetooth/hci_bcsp.o] Error 1 make[2]: *** Waiting for unfinished jobs.... make[1]: *** [scripts/Makefile.build:465: drivers/bluetooth] Error 2 make: *** [Makefile:1852: drivers] Error 2
tedd_an/incremental_build pending Incremental Build Kernel SKIP(Build Fail)
tedd_an/testrunnersetup success Test Runner Setup PASS
tedd_an/testrunnerl2cap-tester success Total: 40, Passed: 40 (100.0%), Failed: 0, Not Run: 0
tedd_an/testrunneriso-tester success Total: 55, Passed: 55 (100.0%), Failed: 0, Not Run: 0
tedd_an/testrunnerbnep-tester success Total: 1, Passed: 1 (100.0%), Failed: 0, Not Run: 0
tedd_an/testrunnermgmt-tester success Total: 494, Passed: 494 (100.0%), Failed: 0, Not Run: 0
tedd_an/testrunnerrfcomm-tester success Total: 11, Passed: 11 (100.0%), Failed: 0, Not Run: 0
tedd_an/testrunnersco-tester success Total: 12, Passed: 12 (100.0%), Failed: 0, Not Run: 0
tedd_an/testrunnerioctl-tester success Total: 28, Passed: 28 (100.0%), Failed: 0, Not Run: 0
tedd_an/testrunnermesh-tester success Total: 10, Passed: 10 (100.0%), Failed: 0, Not Run: 0
tedd_an/testrunnersmp-tester success Total: 8, Passed: 8 (100.0%), Failed: 0, Not Run: 0
tedd_an/testrunneruserchan-tester success Total: 4, Passed: 4 (100.0%), Failed: 0, Not Run: 0
tedd_an/CheckPatch success CheckPatch PASS
tedd_an/GitLint success Gitlint PASS
tedd_an/SubjectPrefix success Gitlint PASS
tedd_an/BuildKernel fail BuildKernel: make FAIL: drivers/bluetooth/hci_bcsp.c: In function ‘bcsp_close’: drivers/bluetooth/hci_bcsp.c:740:2: error: implicit declaration of function ‘del_timer_shutdown’; did you mean ‘device_shutdown’? [-Werror=implicit-function-declaration] 740 | del_timer_shutdown(&bcsp->tbcsp); | ^~~~~~~~~~~~~~~~~~ | device_shutdown cc1: some warnings being treated as errors make[2]: *** [scripts/Makefile.build:249: drivers/bluetooth/hci_bcsp.o] Error 1 make[2]: *** Waiting for unfinished jobs.... make[1]: *** [scripts/Makefile.build:465: drivers/bluetooth] Error 2 make: *** [Makefile:1852: drivers] Error 2
tedd_an/BuildKernel32 fail BuildKernel32: make FAIL: drivers/bluetooth/hci_bcsp.c: In function ‘bcsp_close’: drivers/bluetooth/hci_bcsp.c:740:2: error: implicit declaration of function ‘del_timer_shutdown’; did you mean ‘device_shutdown’? [-Werror=implicit-function-declaration] 740 | del_timer_shutdown(&bcsp->tbcsp); | ^~~~~~~~~~~~~~~~~~ | device_shutdown cc1: some warnings being treated as errors make[2]: *** [scripts/Makefile.build:249: drivers/bluetooth/hci_bcsp.o] Error 1 make[2]: *** Waiting for unfinished jobs.... make[1]: *** [scripts/Makefile.build:465: drivers/bluetooth] Error 2 make: *** [Makefile:1852: drivers] Error 2
tedd_an/TestRunnerSetup success TestRunnerSetup PASS
tedd_an/TestRunner_l2cap-tester success TestRunner PASS
tedd_an/TestRunner_iso-tester success TestRunner PASS
tedd_an/TestRunner_bnep-tester success TestRunner PASS
tedd_an/TestRunner_mgmt-tester success TestRunner PASS
tedd_an/TestRunner_rfcomm-tester success TestRunner PASS
tedd_an/TestRunner_sco-tester success TestRunner PASS
tedd_an/TestRunner_ioctl-tester success TestRunner PASS
tedd_an/TestRunner_mesh-tester success TestRunner PASS
tedd_an/TestRunner_smp-tester success TestRunner PASS
tedd_an/TestRunner_userchan-tester success TestRunner PASS
tedd_an/IncrementalBuild fail [RFC,v2,08/31] timers: Bluetooth: Use del_timer_shutdown() before freeing timer drivers/bluetooth/hci_bcsp.c: In function ‘bcsp_close’: drivers/bluetooth/hci_bcsp.c:740:2: error: implicit declaration of function ‘del_timer_shutdown’; did you mean ‘device_shutdown’? [-Werror=implicit-function-declaration] 740 | del_timer_shutdown(&bcsp->tbcsp); | ^~~~~~~~~~~~~~~~~~ | device_shutdown cc1: some warnings being treated as errors make[2]: *** [scripts/Makefile.build:249: drivers/bluetooth/hci_bcsp.o] Error 1 make[2]: *** Waiting for unfinished jobs.... make[1]: *** [scripts/Makefile.build:465: drivers/bluetooth] Error 2 make: *** [Makefile:1852: drivers] Error 2

Commit Message

Steven Rostedt Oct. 27, 2022, 3:05 p.m. UTC
From: "Steven Rostedt (Google)" <rostedt@goodmis.org>

Before a timer is freed, del_timer_shutdown() must be called.

Link: https://lore.kernel.org/all/20220407161745.7d6754b3@gandalf.local.home/

Cc: Marcel Holtmann <marcel@holtmann.org>
Cc: Johan Hedberg <johan.hedberg@gmail.com>
Cc: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
Cc: linux-bluetooth@vger.kernel.org
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
---
 drivers/bluetooth/hci_bcsp.c | 2 +-
 drivers/bluetooth/hci_h5.c   | 2 +-
 drivers/bluetooth/hci_qca.c  | 4 ++--
 3 files changed, 4 insertions(+), 4 deletions(-)

Comments

Luiz Augusto von Dentz Oct. 29, 2022, 12:12 a.m. UTC | #1
Hi Steven,

On Thu, Oct 27, 2022 at 8:09 AM Steven Rostedt <rostedt@goodmis.org> wrote:
>
> From: "Steven Rostedt (Google)" <rostedt@goodmis.org>
>
> Before a timer is freed, del_timer_shutdown() must be called.
>
> Link: https://lore.kernel.org/all/20220407161745.7d6754b3@gandalf.local.home/
>
> Cc: Marcel Holtmann <marcel@holtmann.org>
> Cc: Johan Hedberg <johan.hedberg@gmail.com>
> Cc: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
> Cc: linux-bluetooth@vger.kernel.org
> Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>

Acked-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

Btw, we do seem to have similar problems with the likes of
cancel_delayed_work/cancel_delayed_work_sync so wonder if it wouldn't
be the case to introduce something like shutdown_delayed_work before
freeing the struct/object containing it?

> ---
>  drivers/bluetooth/hci_bcsp.c | 2 +-
>  drivers/bluetooth/hci_h5.c   | 2 +-
>  drivers/bluetooth/hci_qca.c  | 4 ++--
>  3 files changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/bluetooth/hci_bcsp.c b/drivers/bluetooth/hci_bcsp.c
> index cf4a56095817..69caaff37141 100644
> --- a/drivers/bluetooth/hci_bcsp.c
> +++ b/drivers/bluetooth/hci_bcsp.c
> @@ -737,7 +737,7 @@ static int bcsp_close(struct hci_uart *hu)
>  {
>         struct bcsp_struct *bcsp = hu->priv;
>
> -       del_timer_sync(&bcsp->tbcsp);
> +       del_timer_shutdown(&bcsp->tbcsp);
>
>         hu->priv = NULL;
>
> diff --git a/drivers/bluetooth/hci_h5.c b/drivers/bluetooth/hci_h5.c
> index c5a0409ef84f..08a36ea9eea9 100644
> --- a/drivers/bluetooth/hci_h5.c
> +++ b/drivers/bluetooth/hci_h5.c
> @@ -253,7 +253,7 @@ static int h5_close(struct hci_uart *hu)
>  {
>         struct h5 *h5 = hu->priv;
>
> -       del_timer_sync(&h5->timer);
> +       del_timer_shutdown(&h5->timer);
>
>         skb_queue_purge(&h5->unack);
>         skb_queue_purge(&h5->rel);
> diff --git a/drivers/bluetooth/hci_qca.c b/drivers/bluetooth/hci_qca.c
> index 8df11016fd51..1796166ba35d 100644
> --- a/drivers/bluetooth/hci_qca.c
> +++ b/drivers/bluetooth/hci_qca.c
> @@ -697,8 +697,8 @@ static int qca_close(struct hci_uart *hu)
>         skb_queue_purge(&qca->txq);
>         skb_queue_purge(&qca->rx_memdump_q);
>         destroy_workqueue(qca->workqueue);
> -       del_timer_sync(&qca->tx_idle_timer);
> -       del_timer_sync(&qca->wake_retrans_timer);
> +       del_timer_shutdown(&qca->tx_idle_timer);
> +       del_timer_shutdown(&qca->wake_retrans_timer);
>         qca->hu = NULL;
>
>         kfree_skb(qca->rx_skb);
> --
> 2.35.1
Steven Rostedt Oct. 29, 2022, 12:33 a.m. UTC | #2
On Fri, 28 Oct 2022 17:12:44 -0700
Luiz Augusto von Dentz <luiz.dentz@gmail.com> wrote:

> Acked-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

Thanks, but I will be sending a v2 as the naming is going to change.

> 
> Btw, we do seem to have similar problems with the likes of
> cancel_delayed_work/cancel_delayed_work_sync so wonder if it wouldn't
> be the case to introduce something like shutdown_delayed_work before
> freeing the struct/object containing it?

As I stated here:

  https://lore.kernel.org/all/20221028100052.2e392127@gandalf.local.home/

That may be the next endevour I partake in.


Cheers,

-- Steve
diff mbox series

Patch

diff --git a/drivers/bluetooth/hci_bcsp.c b/drivers/bluetooth/hci_bcsp.c
index cf4a56095817..69caaff37141 100644
--- a/drivers/bluetooth/hci_bcsp.c
+++ b/drivers/bluetooth/hci_bcsp.c
@@ -737,7 +737,7 @@  static int bcsp_close(struct hci_uart *hu)
 {
 	struct bcsp_struct *bcsp = hu->priv;
 
-	del_timer_sync(&bcsp->tbcsp);
+	del_timer_shutdown(&bcsp->tbcsp);
 
 	hu->priv = NULL;
 
diff --git a/drivers/bluetooth/hci_h5.c b/drivers/bluetooth/hci_h5.c
index c5a0409ef84f..08a36ea9eea9 100644
--- a/drivers/bluetooth/hci_h5.c
+++ b/drivers/bluetooth/hci_h5.c
@@ -253,7 +253,7 @@  static int h5_close(struct hci_uart *hu)
 {
 	struct h5 *h5 = hu->priv;
 
-	del_timer_sync(&h5->timer);
+	del_timer_shutdown(&h5->timer);
 
 	skb_queue_purge(&h5->unack);
 	skb_queue_purge(&h5->rel);
diff --git a/drivers/bluetooth/hci_qca.c b/drivers/bluetooth/hci_qca.c
index 8df11016fd51..1796166ba35d 100644
--- a/drivers/bluetooth/hci_qca.c
+++ b/drivers/bluetooth/hci_qca.c
@@ -697,8 +697,8 @@  static int qca_close(struct hci_uart *hu)
 	skb_queue_purge(&qca->txq);
 	skb_queue_purge(&qca->rx_memdump_q);
 	destroy_workqueue(qca->workqueue);
-	del_timer_sync(&qca->tx_idle_timer);
-	del_timer_sync(&qca->wake_retrans_timer);
+	del_timer_shutdown(&qca->tx_idle_timer);
+	del_timer_shutdown(&qca->wake_retrans_timer);
 	qca->hu = NULL;
 
 	kfree_skb(qca->rx_skb);