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: Michael 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.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
u8 *pbuf;
struct wlan_network *pnetwork;
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(). */
pbuf = vzalloc(MAX_BSS_CNT * (sizeof(struct wlan_network)));
- if (!pbuf) {
- res = _FAIL;
- goto exit;
- }
+ if (!pbuf)
+ return -ENOMEM;
+
pmlmepriv->free_bss_buf = pbuf;
pnetwork = (struct wlan_network *)pbuf;
rtw_init_mlme_timer(padapter);
-exit:
-
- return res;
+ return 0;
}
void rtw_free_mlme_priv(struct mlme_priv *pmlmepriv)
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");
goto free_evt_priv;
}