Thread (2 messages) 2 messages, 2 authors, 2021-08-15

Re: [External][PATCH] power: supply: bq2415x: fix deadlock in bq2415x_set_autotimer

From: Sebastian Reichel <hidden>
Date: 2021-08-15 21:53:45
Also in: lkml

Hi,

On Mon, Jun 21, 2021 at 08:14:20PM +0800, Kezhou Li wrote:
From: "Kezhou Li" <redacted>

The bq2415x_timer_error called by bq2415x_timer_work when some error
happens, and then calls cancel_delayed_work_sync(&bq->work). Finally
this function is waiting for the work to finish but the work is
waiting for the return of the function. So it causes a deadlock.

Signed-off-by: Kezhou Li <redacted>
---
The patch is not correct, since bq2415x_sysfs_set_timer() should
call cancel_delayed_work_sync() for the "off" case.

-- Sebastian
quoted hunk ↗ jump to hunk
 drivers/power/supply/bq2415x_charger.c | 2 --
 1 file changed, 2 deletions(-)
diff --git a/drivers/power/supply/bq2415x_charger.c b/drivers/power/supply/bq2415x_charger.c
index 5724001..7889edb 100644
--- a/drivers/power/supply/bq2415x_charger.c
+++ b/drivers/power/supply/bq2415x_charger.c
@@ -862,8 +862,6 @@ static void bq2415x_set_autotimer(struct bq2415x_device *bq, int state)
 		schedule_delayed_work(&bq->work, BQ2415X_TIMER_TIMEOUT * HZ);
 		bq2415x_exec_command(bq, BQ2415X_TIMER_RESET);
 		bq->timer_error = NULL;
-	} else {
-		cancel_delayed_work_sync(&bq->work);
 	}
 
 	mutex_unlock(&bq2415x_timer_mutex);
-- 
1.9.1

Attachments

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help