staging: r8188eu: fix warnings in rtw_p2p
authorVihas Makwana <makvihas@gmail.com>
Tue, 17 May 2022 14:06:24 +0000 (19:36 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 19 May 2022 15:44:43 +0000 (17:44 +0200)
Refactor the code to fix following warning:
    WARNING: Comparisons should place the constant on the right side of the test

Signed-off-by: Vihas Makwana <makvihas@gmail.com>
Link: https://lore.kernel.org/r/20220517140626.3716-2-makvihas@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/r8188eu/core/rtw_p2p.c

index 59bb1bd..beffe5b 100644 (file)
@@ -872,7 +872,7 @@ u32 process_assoc_req_p2p_ie(struct wifidirect_info *pwdinfo, u8 *pframe, uint l
                                }
 
                                psta->dev_name_len = 0;
-                               if (WPS_ATTR_DEVICE_NAME == be16_to_cpu(*(__be16 *)pattr_content)) {
+                               if (be16_to_cpu(*(__be16 *)pattr_content) == WPS_ATTR_DEVICE_NAME) {
                                        dev_name_len = be16_to_cpu(*(__be16 *)(pattr_content + 2));
 
                                        psta->dev_name_len = (sizeof(psta->dev_name) < dev_name_len) ? sizeof(psta->dev_name) : dev_name_len;
@@ -1213,7 +1213,7 @@ u8 process_p2p_group_negotation_resp(struct wifidirect_info *pwdinfo, u8 *pframe
                                if (attr_content == P2P_STATUS_SUCCESS) {
                                        /*      Do nothing. */
                                } else {
-                                       if (P2P_STATUS_FAIL_INFO_UNAVAILABLE == attr_content) {
+                                       if (attr_content == P2P_STATUS_FAIL_INFO_UNAVAILABLE) {
                                                rtw_p2p_set_state(pwdinfo, P2P_STATE_RX_INFOR_NOREADY);
                                        } else {
                                                rtw_p2p_set_state(pwdinfo, P2P_STATE_GONEGO_FAIL);
@@ -1891,7 +1891,7 @@ int rtw_p2p_enable(struct adapter *padapter, enum P2P_ROLE role)
 
        if (role == P2P_ROLE_DEVICE || role == P2P_ROLE_CLIENT || role == P2P_ROLE_GO) {
                /* leave IPS/Autosuspend */
-               if (_FAIL == rtw_pwr_wakeup(padapter)) {
+               if (rtw_pwr_wakeup(padapter) == _FAIL) {
                        ret = _FAIL;
                        goto exit;
                }
@@ -1905,7 +1905,7 @@ int rtw_p2p_enable(struct adapter *padapter, enum P2P_ROLE role)
                init_wifidirect_info(padapter, role);
 
        } else if (role == P2P_ROLE_DISABLE) {
-               if (_FAIL == rtw_pwr_wakeup(padapter)) {
+               if (rtw_pwr_wakeup(padapter) == _FAIL) {
                        ret = _FAIL;
                        goto exit;
                }