Commit 40b3f622 authored by Michael Straube's avatar Michael Straube Committed by Greg Kroah-Hartman

staging: r8188eu: convert rtw_init_mlme_priv() to common error logic

Convert the function rtw_init_mlme_priv() to common kernel error logic.
Return 0 on success and negative value on failure. This is part of
getting rid of returning _SUCCESS and _FAIL which uses inverted error
logic and is used all over the driver.
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/20221002074827.8566-5-straube.linux@gmail.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent d4fda247
...@@ -224,7 +224,6 @@ int rtw_init_mlme_priv(struct adapter *padapter)/* struct mlme_priv *pmlmepriv) ...@@ -224,7 +224,6 @@ int rtw_init_mlme_priv(struct adapter *padapter)/* struct mlme_priv *pmlmepriv)
u8 *pbuf; u8 *pbuf;
struct wlan_network *pnetwork; struct wlan_network *pnetwork;
struct mlme_priv *pmlmepriv = &padapter->mlmepriv; struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
int res = _SUCCESS;
/* We don't need to memset padapter->XXX to zero, because adapter is allocated by vzalloc(). */ /* We don't need to memset padapter->XXX to zero, because adapter is allocated by vzalloc(). */
...@@ -245,10 +244,9 @@ int rtw_init_mlme_priv(struct adapter *padapter)/* struct mlme_priv *pmlmepriv) ...@@ -245,10 +244,9 @@ int rtw_init_mlme_priv(struct adapter *padapter)/* struct mlme_priv *pmlmepriv)
pbuf = vzalloc(MAX_BSS_CNT * (sizeof(struct wlan_network))); pbuf = vzalloc(MAX_BSS_CNT * (sizeof(struct wlan_network)));
if (!pbuf) { if (!pbuf)
res = _FAIL; return -ENOMEM;
goto exit;
}
pmlmepriv->free_bss_buf = pbuf; pmlmepriv->free_bss_buf = pbuf;
pnetwork = (struct wlan_network *)pbuf; pnetwork = (struct wlan_network *)pbuf;
...@@ -265,9 +263,7 @@ int rtw_init_mlme_priv(struct adapter *padapter)/* struct mlme_priv *pmlmepriv) ...@@ -265,9 +263,7 @@ int rtw_init_mlme_priv(struct adapter *padapter)/* struct mlme_priv *pmlmepriv)
rtw_init_mlme_timer(padapter); rtw_init_mlme_timer(padapter);
exit: return 0;
return res;
} }
void rtw_free_mlme_priv(struct mlme_priv *pmlmepriv) void rtw_free_mlme_priv(struct mlme_priv *pmlmepriv)
......
...@@ -473,7 +473,7 @@ u8 rtw_init_drv_sw(struct adapter *padapter) ...@@ -473,7 +473,7 @@ u8 rtw_init_drv_sw(struct adapter *padapter)
goto free_cmd_priv; goto free_cmd_priv;
} }
if (rtw_init_mlme_priv(padapter) == _FAIL) { if (rtw_init_mlme_priv(padapter)) {
dev_err(dvobj_to_dev(padapter->dvobj), "rtw_init_mlme_priv failed\n"); dev_err(dvobj_to_dev(padapter->dvobj), "rtw_init_mlme_priv failed\n");
goto free_evt_priv; goto free_evt_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