From 9773cf1c1a803ea6c5f2726489d9bd518c17f869 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Pouiller?= Date: Fri, 15 May 2020 10:33:07 +0200 Subject: [PATCH] staging: wfx: fix warning when unregister a frozen device MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit The device does not answer to the command hif_shutdown. Therefore, hif_shutdown() is a bit special. It bypasses some of work normally made by wfx_cmd_send(). In particularly, it unlock hif_cmd.lock and hif_cmd.key_renew_lock. However, if the driver notice that the device is frozen, wfx_cmd_send() stops to send data and doesn't lock the mutexes. Then, it produced a warning when hif_shutdown() tried to unlock these mutexes. Signed-off-by: Jérôme Pouiller Link: https://lore.kernel.org/r/20200515083325.378539-2-Jerome.Pouiller@silabs.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wfx/hif_tx.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/staging/wfx/hif_tx.c b/drivers/staging/wfx/hif_tx.c index 7f45971..3e5d911 100644 --- a/drivers/staging/wfx/hif_tx.c +++ b/drivers/staging/wfx/hif_tx.c @@ -131,6 +131,8 @@ int hif_shutdown(struct wfx_dev *wdev) int ret; struct hif_msg *hif; + if (wdev->chip_frozen) + return 0; wfx_alloc_hif(0, &hif); wfx_fill_header(hif, -1, HIF_REQ_ID_SHUT_DOWN, 0); ret = wfx_cmd_send(wdev, hif, NULL, 0, true); -- 2.7.4