Commit 7e00e0c4 authored by Michael Straube's avatar Michael Straube Committed by Greg Kroah-Hartman

staging: r8188eu: correct error logic of rtl8188eu_init_recv_priv()

Convert the function rtl8188eu_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-2-straube.linux@gmail.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 2f36e789
...@@ -38,7 +38,7 @@ void _rtw_init_sta_recv_priv(struct sta_recv_priv *psta_recvpriv) ...@@ -38,7 +38,7 @@ void _rtw_init_sta_recv_priv(struct sta_recv_priv *psta_recvpriv)
static int rtl8188eu_init_recv_priv(struct adapter *padapter) static int rtl8188eu_init_recv_priv(struct adapter *padapter)
{ {
struct recv_priv *precvpriv = &padapter->recvpriv; struct recv_priv *precvpriv = &padapter->recvpriv;
int i, res = _SUCCESS; int i, err = 0;
struct recv_buf *precvbuf; struct recv_buf *precvbuf;
tasklet_init(&precvpriv->recv_tasklet, tasklet_init(&precvpriv->recv_tasklet,
...@@ -50,10 +50,8 @@ static int rtl8188eu_init_recv_priv(struct adapter *padapter) ...@@ -50,10 +50,8 @@ static int rtl8188eu_init_recv_priv(struct adapter *padapter)
precvpriv->pallocated_recv_buf = kzalloc(NR_RECVBUFF * sizeof(struct recv_buf) + 4, precvpriv->pallocated_recv_buf = kzalloc(NR_RECVBUFF * sizeof(struct recv_buf) + 4,
GFP_KERNEL); GFP_KERNEL);
if (!precvpriv->pallocated_recv_buf) { if (!precvpriv->pallocated_recv_buf)
res = _FAIL; return -ENOMEM;
goto exit;
}
precvpriv->precv_buf = (u8 *)ALIGN((size_t)(precvpriv->pallocated_recv_buf), 4); precvpriv->precv_buf = (u8 *)ALIGN((size_t)(precvpriv->pallocated_recv_buf), 4);
...@@ -64,7 +62,7 @@ static int rtl8188eu_init_recv_priv(struct adapter *padapter) ...@@ -64,7 +62,7 @@ static int rtl8188eu_init_recv_priv(struct adapter *padapter)
precvbuf->reuse = false; precvbuf->reuse = false;
precvbuf->purb = usb_alloc_urb(0, GFP_KERNEL); precvbuf->purb = usb_alloc_urb(0, GFP_KERNEL);
if (!precvbuf->purb) { if (!precvbuf->purb) {
res = _FAIL; err = -ENOMEM;
break; break;
} }
precvbuf->adapter = padapter; precvbuf->adapter = padapter;
...@@ -94,8 +92,8 @@ static int rtl8188eu_init_recv_priv(struct adapter *padapter) ...@@ -94,8 +92,8 @@ static int rtl8188eu_init_recv_priv(struct adapter *padapter)
pskb = NULL; pskb = NULL;
} }
} }
exit:
return res; return err;
} }
int _rtw_init_recv_priv(struct recv_priv *precvpriv, struct adapter *padapter) int _rtw_init_recv_priv(struct recv_priv *precvpriv, struct adapter *padapter)
...@@ -141,7 +139,8 @@ int _rtw_init_recv_priv(struct recv_priv *precvpriv, struct adapter *padapter) ...@@ -141,7 +139,8 @@ int _rtw_init_recv_priv(struct recv_priv *precvpriv, struct adapter *padapter)
} }
precvpriv->rx_pending_cnt = 1; precvpriv->rx_pending_cnt = 1;
res = rtl8188eu_init_recv_priv(padapter); if (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 */
......
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