diff options
author | Michael Straube <straube.linux@gmail.com> | 2023-02-05 11:05:59 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2023-02-06 12:48:01 +0300 |
commit | 3d281bdbffb330da562df985dc30ed1075b638f4 (patch) | |
tree | 7e06fb32618119a15095c4dc3fabecfa59df3be9 /drivers/staging | |
parent | 7e00e0c42d119090373d179a6fdc2ab09db5c4f8 (diff) | |
download | linux-3d281bdbffb330da562df985dc30ed1075b638f4.tar.xz |
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: Michael 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.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging')
-rw-r--r-- | drivers/staging/r8188eu/core/rtw_recv.c | 17 | ||||
-rw-r--r-- | drivers/staging/r8188eu/os_dep/os_intfs.c | 2 |
2 files changed, 6 insertions, 13 deletions
diff --git a/drivers/staging/r8188eu/core/rtw_recv.c b/drivers/staging/r8188eu/core/rtw_recv.c index 70d43c10e53d..fc7568cf948b 100644 --- a/drivers/staging/r8188eu/core/rtw_recv.c +++ b/drivers/staging/r8188eu/core/rtw_recv.c @@ -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 i; - struct recv_frame *precvframe; - - int res = _SUCCESS; + int err; spin_lock_init(&precvpriv->lock); @@ -115,11 +113,8 @@ int _rtw_init_recv_priv(struct recv_priv *precvpriv, struct adapter *padapter) precvpriv->free_recvframe_cnt = NR_RECVFRAME; precvpriv->pallocated_frame_buf = vzalloc(NR_RECVFRAME * sizeof(struct recv_frame) + RXFRAME_ALIGN_SZ); - - if (!precvpriv->pallocated_frame_buf) { - res = _FAIL; - goto exit; - } + if (!precvpriv->pallocated_frame_buf) + return -ENOMEM; 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) } precvpriv->rx_pending_cnt = 1; - if (rtl8188eu_init_recv_priv(padapter)) - res = _FAIL; + err = rtl8188eu_init_recv_priv(padapter); timer_setup(&precvpriv->signal_stat_timer, rtw_signal_stat_timer_hdl, 0); precvpriv->signal_stat_sampling_interval = 1000; /* ms */ rtw_set_signal_stat_timer(precvpriv); -exit: - return res; + return err; } static void rtl8188eu_free_recv_priv(struct adapter *padapter) diff --git a/drivers/staging/r8188eu/os_dep/os_intfs.c b/drivers/staging/r8188eu/os_dep/os_intfs.c index cfc24420e70c..4130e8fe2952 100644 --- a/drivers/staging/r8188eu/os_dep/os_intfs.c +++ b/drivers/staging/r8188eu/os_dep/os_intfs.c @@ -482,7 +482,7 @@ u8 rtw_init_drv_sw(struct adapter *padapter) 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"); goto free_xmit_priv; } |