Commit 590b03a8 authored by Pavel Skripkin's avatar Pavel Skripkin Committed by Greg Kroah-Hartman
Browse files

staging: r8188eu: make _rtw_init_queue a macro



While testing latest updates I hit lockdep warning:

[   42.694425] ============================================
[   42.694785] WARNING: possible recursive locking detected
[   42.695120] 5.14.0+ #25 Tainted: G         C
[   42.695422] --------------------------------------------
[   42.695747] RTW_CMD_THREAD/317 is trying to acquire lock:
[   42.696078] ffffc900006c90b0 (&pqueue->lock){+.-.}-{3:3}, at: _rtw_alloc_network+0x1e/0x321 [r8188eu]
[   42.696686]
[   42.696686] but task is already holding lock:
[   42.697148] ffffc900006c9100 (&pqueue->lock){+.-.}-{3:3}, at: rtw_update_scanned_network+0x31/0x76b [r8188eu]
[   42.697758]
[   42.697758] other info that might help us debug this:
[   42.698326]  Possible unsafe locking scenario:
[   42.698326]
[   42.698696]        CPU0
[   42.698847]        ----
[   42.698997]   lock(&pqueue->lock);
[   42.699209]   lock(&pqueue->lock);
[   42.699418]
[   42.699418]  *** DEADLOCK ***
[   42.699418]
[   42.699768]  May be due to missing lock nesting notation

It's false positive, since all queue spinlocks are initialized via
private API which has pqueue as agrument. Fix it by making
_rtw_init_queue a macro instead of function + removed unneeded _ prefix.

Signed-off-by: default avatarPavel Skripkin <paskripkin@gmail.com>
Link: https://lore.kernel.org/r/20210908194309.9086-1-paskripkin@gmail.com


Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent e4c1935e
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -18,7 +18,7 @@ void init_mlme_ap_info(struct adapter *padapter)
	spin_lock_init(&pmlmepriv->bcn_update_lock);

	/* for ACL */
	_rtw_init_queue(&pacl_list->acl_node_q);
	rtw_init_queue(&pacl_list->acl_node_q);

	start_ap_mode(padapter);
}
+1 −1
Original line number Diff line number Diff line
@@ -25,7 +25,7 @@ static int _rtw_init_cmd_priv(struct cmd_priv *pcmdpriv)
	/* sema_init(&(pcmdpriv->cmd_done_sema), 0); */
	sema_init(&pcmdpriv->terminate_cmdthread_sema, 0);

	_rtw_init_queue(&pcmdpriv->cmd_queue);
	rtw_init_queue(&pcmdpriv->cmd_queue);

	/* allocate DMA-able/Non-Page memory for cmd_buf and rsp_buf */

+2 −2
Original line number Diff line number Diff line
@@ -49,8 +49,8 @@ int _rtw_init_mlme_priv(struct adapter *padapter)
	pmlmepriv->scan_mode = SCAN_ACTIVE;/*  1: active, 0: pasive. Maybe someday we should rename this varable to "active_mode" (Jeff) */

	spin_lock_init(&pmlmepriv->lock);
	_rtw_init_queue(&pmlmepriv->free_bss_pool);
	_rtw_init_queue(&pmlmepriv->scanned_queue);
	rtw_init_queue(&pmlmepriv->free_bss_pool);
	rtw_init_queue(&pmlmepriv->scanned_queue);

	set_scanned_network_val(pmlmepriv, 0);

+1 −1
Original line number Diff line number Diff line
@@ -889,7 +889,7 @@ void _rtw_mp_xmit_priv(struct xmit_priv *pxmitpriv)
	}

	/*  Init xmit extension buff */
	_rtw_init_queue(&pxmitpriv->free_xmit_extbuf_queue);
	rtw_init_queue(&pxmitpriv->free_xmit_extbuf_queue);

	pxmitpriv->pallocated_xmit_extbuf = vzalloc(num_xmit_extbuf * sizeof(struct xmit_buf) + 4);

+4 −4
Original line number Diff line number Diff line
@@ -31,7 +31,7 @@ void _rtw_init_sta_recv_priv(struct sta_recv_priv *psta_recvpriv)

	spin_lock_init(&psta_recvpriv->lock);

	_rtw_init_queue(&psta_recvpriv->defrag_q);
	rtw_init_queue(&psta_recvpriv->defrag_q);

}

@@ -45,9 +45,9 @@ int _rtw_init_recv_priv(struct recv_priv *precvpriv, struct adapter *padapter)

	spin_lock_init(&precvpriv->lock);

	_rtw_init_queue(&precvpriv->free_recv_queue);
	_rtw_init_queue(&precvpriv->recv_pending_queue);
	_rtw_init_queue(&precvpriv->uc_swdec_pending_queue);
	rtw_init_queue(&precvpriv->free_recv_queue);
	rtw_init_queue(&precvpriv->recv_pending_queue);
	rtw_init_queue(&precvpriv->uc_swdec_pending_queue);

	precvpriv->adapter = padapter;

Loading