Skip to contentSkip to conversation

staging: rtlwifi: Use proper enum for return in halmac_parse_psd_data_88xx

PATCH In review Nathan Chancellor 2 participants 2 messages Feb 21, 2019 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 staging: rtlwifi: Use proper enum for return in halmac_parse_psd_data_88xx

Clang warns:

drivers/staging/rtlwifi/halmac/halmac_88xx/halmac_func_88xx.c:2472:11:
warning: implicit conversion from enumeration type 'enum halmac_cmd_process_status' to different enumeration type 'enum halmac_ret_status' [-Wenum-conversion]

                        return HALMAC_CMD_PROCESS_ERROR;
                        ~~~~~~ ^~~~~~~~~~~~~~~~~~~~~~~~

1 warning generated.

Fix this by using the proper enum for allocation failures, HALMAC_RET_MALLOC_FAIL, which is used in the rest of this file.

Fixes e4b08e16b7d9 ("staging: r8822be: check kzalloc return or bail")
---
 drivers/staging/rtlwifi/halmac/halmac_88xx/halmac_func_88xx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/rtlwifi/halmac/halmac_88xx/halmac_func_88xx.c +1 -1
index ec742da030db..ddbeff8224ab 100644
@@ -2469,7 +2469,7 @@ halmac_parse_psd_data_88xx(struct halmac_adapter *halmac_adapter, u8 *c2h_buf,
 	if (!psd_set->data) {
 		psd_set->data = kzalloc(psd_set->data_size, GFP_KERNEL);
 		if (!psd_set->data)
-			return HALMAC_CMD_PROCESS_ERROR;
+			return HALMAC_RET_MALLOC_FAIL;
 	}
 
 	if (segment_id == 0)
Signature · 1 line
2.21.0.rc1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 10 lines · Nathan Chancellor

Clang warns:

drivers/staging/rtlwifi/halmac/halmac_88xx/halmac_func_88xx.c:2472:11:
warning: implicit conversion from enumeration type 'enum halmac_cmd_process_status' to different enumeration type 'enum halmac_ret_status' [-Wenum-conversion]

                        return HALMAC_CMD_PROCESS_ERROR;
                        ~~~~~~ ^~~~~~~~~~~~~~~~~~~~~~~~

1 warning generated.

yup - my bad I somehow managed to end up in halmac_cmd_process_status rather than halmac_ret_status - HALMAC_RET_MALLOC_FAIL makes sense here.

interesting that gcc did not fuss at this.

thx!
hofrat

Quoted 6 lines

Fix this by using the proper enum for allocation failures, HALMAC_RET_MALLOC_FAIL, which is used in the rest of this file.

Fixes e4b08e16b7d9 ("staging: r8822be: check kzalloc return or bail")
Quoted 20 lines
---
 drivers/staging/rtlwifi/halmac/halmac_88xx/halmac_func_88xx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/rtlwifi/halmac/halmac_88xx/halmac_func_88xx.c +1 -1
index ec742da030db..ddbeff8224ab 100644
@@ -2469,7 +2469,7 @@ halmac_parse_psd_data_88xx(struct halmac_adapter *halmac_adapter, u8 *c2h_buf,
 	if (!psd_set->data) {
 		psd_set->data = kzalloc(psd_set->data_size, GFP_KERNEL);
 		if (!psd_set->data)
-			return HALMAC_CMD_PROCESS_ERROR;
+			return HALMAC_RET_MALLOC_FAIL;
 	}
 
 	if (segment_id == 0)
Signature · 1 line
2.21.0.rc1