Commit 3d281bdb authored by Michael Straube's avatar Michael Straube Committed by Greg Kroah-Hartman

staging: r8188eu: correct error logic of _rtw_init_recv_priv()

Convert the function _rtw_init_recv_priv() away from returning _FAIL
and _SUCCESS, which uses inverted error logic. Return 0 for success
and negative values for failure instead.
Signed-off-by: default avatarMichael Straube <straube.linux@gmail.com>
Tested-by: Philipp Hortmann <philipp.g.hortmann@gmail.com> # Edimax N150
Link: https://lore.kernel.org/r/20230205080559.8319-3-straube.linux@gmail.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 7e00e0c4
...@@ -99,10 +99,8 @@ static int rtl8188eu_init_recv_priv(struct adapter *padapter) ...@@ -99,10 +99,8 @@ static int rtl8188eu_init_recv_priv(struct adapter *padapter)
int _rtw_init_recv_priv(struct recv_priv *precvpriv, struct adapter *padapter) int _rtw_init_recv_priv(struct recv_priv *precvpriv, struct adapter *padapter)
{ {
int i; int i;
struct recv_frame *precvframe; struct recv_frame *precvframe;
int err;
int res = _SUCCESS;
spin_lock_init(&precvpriv->lock); spin_lock_init(&precvpriv->lock);
...@@ -115,11 +113,8 @@ int _rtw_init_recv_priv(struct recv_priv *precvpriv, struct adapter *padapter) ...@@ -115,11 +113,8 @@ int _rtw_init_recv_priv(struct recv_priv *precvpriv, struct adapter *padapter)
precvpriv->free_recvframe_cnt = NR_RECVFRAME; precvpriv->free_recvframe_cnt = NR_RECVFRAME;
precvpriv->pallocated_frame_buf = vzalloc(NR_RECVFRAME * sizeof(struct recv_frame) + RXFRAME_ALIGN_SZ); precvpriv->pallocated_frame_buf = vzalloc(NR_RECVFRAME * sizeof(struct recv_frame) + RXFRAME_ALIGN_SZ);
if (!precvpriv->pallocated_frame_buf)
if (!precvpriv->pallocated_frame_buf) { return -ENOMEM;
res = _FAIL;
goto exit;
}
precvpriv->precv_frame_buf = (u8 *)ALIGN((size_t)(precvpriv->pallocated_frame_buf), RXFRAME_ALIGN_SZ); precvpriv->precv_frame_buf = (u8 *)ALIGN((size_t)(precvpriv->pallocated_frame_buf), RXFRAME_ALIGN_SZ);
...@@ -139,16 +134,14 @@ int _rtw_init_recv_priv(struct recv_priv *precvpriv, struct adapter *padapter) ...@@ -139,16 +134,14 @@ int _rtw_init_recv_priv(struct recv_priv *precvpriv, struct adapter *padapter)
} }
precvpriv->rx_pending_cnt = 1; precvpriv->rx_pending_cnt = 1;
if (rtl8188eu_init_recv_priv(padapter)) err = rtl8188eu_init_recv_priv(padapter);
res = _FAIL;
timer_setup(&precvpriv->signal_stat_timer, rtw_signal_stat_timer_hdl, 0); timer_setup(&precvpriv->signal_stat_timer, rtw_signal_stat_timer_hdl, 0);
precvpriv->signal_stat_sampling_interval = 1000; /* ms */ precvpriv->signal_stat_sampling_interval = 1000; /* ms */
rtw_set_signal_stat_timer(precvpriv); rtw_set_signal_stat_timer(precvpriv);
exit:
return res; return err;
} }
static void rtl8188eu_free_recv_priv(struct adapter *padapter) static void rtl8188eu_free_recv_priv(struct adapter *padapter)
......
...@@ -482,7 +482,7 @@ u8 rtw_init_drv_sw(struct adapter *padapter) ...@@ -482,7 +482,7 @@ u8 rtw_init_drv_sw(struct adapter *padapter)
goto free_mlme_ext; goto free_mlme_ext;
} }
if (_rtw_init_recv_priv(&padapter->recvpriv, padapter) == _FAIL) { if (_rtw_init_recv_priv(&padapter->recvpriv, padapter)) {
dev_err(dvobj_to_dev(padapter->dvobj), "_rtw_init_recv_priv failed\n"); dev_err(dvobj_to_dev(padapter->dvobj), "_rtw_init_recv_priv failed\n");
goto free_xmit_priv; goto free_xmit_priv;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment