]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
wifi: rtw89: use int type to store negative error codes
authorQianfeng Rong <rongqianfeng@vivo.com>
Wed, 27 Aug 2025 15:06:19 +0000 (23:06 +0800)
committerPing-Ke Shih <pkshih@realtek.com>
Mon, 1 Sep 2025 03:27:36 +0000 (11:27 +0800)
The 'ret' variable stores returns from other functions, which return
either zero on success or negative error codes on failure.  Storing
error codes in u32 (an unsigned type) causes no runtime issues but is
stylistically inconsistent and very ugly.  Change 'ret' from u32 to
int - this has no runtime impact.

Signed-off-by: Qianfeng Rong <rongqianfeng@vivo.com>
Acked-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://patch.msgid.link/20250827150620.550641-1-rongqianfeng@vivo.com
drivers/net/wireless/realtek/rtw89/fw.c
drivers/net/wireless/realtek/rtw89/mac.c
drivers/net/wireless/realtek/rtw89/pci.c

index 334c33e6251d24d344f5f0952e41da887ee5c734..5f330b625659e60b55d134ba2271346e00ff1b36 100644 (file)
@@ -1542,7 +1542,7 @@ static int __rtw89_fw_download_hdr(struct rtw89_dev *rtwdev,
        struct rtw89_fw_hdr *fw_hdr;
        struct sk_buff *skb;
        u32 truncated;
-       u32 ret = 0;
+       int ret;
 
        skb = rtw89_fw_h2c_alloc_skb_with_hdr(rtwdev, len);
        if (!skb) {
@@ -6918,8 +6918,9 @@ static int rtw89_fw_read_c2h_reg(struct rtw89_dev *rtwdev,
        const struct rtw89_chip_info *chip = rtwdev->chip;
        struct rtw89_fw_info *fw_info = &rtwdev->fw;
        const u32 *c2h_reg = chip->c2h_regs;
-       u32 ret, timeout;
+       u32 timeout;
        u8 i, val;
+       int ret;
 
        info->id = RTW89_FWCMD_C2HREG_FUNC_NULL;
 
@@ -6957,7 +6958,7 @@ int rtw89_fw_msg_reg(struct rtw89_dev *rtwdev,
                     struct rtw89_mac_h2c_info *h2c_info,
                     struct rtw89_mac_c2h_info *c2h_info)
 {
-       u32 ret;
+       int ret;
 
        if (h2c_info && h2c_info->id != RTW89_FWCMD_H2CREG_FUNC_GET_FEATURE)
                lockdep_assert_wiphy(rtwdev->hw->wiphy);
index 06fc113ffaf0f5c8d289296b51883defe968e3e5..fd11b8fb3c8999647f94b4a6ff0d937983597af4 100644 (file)
@@ -178,7 +178,7 @@ int rtw89_mac_dle_dfi_qempty_cfg(struct rtw89_dev *rtwdev,
                                 struct rtw89_mac_dle_dfi_qempty *qempty)
 {
        struct rtw89_mac_dle_dfi_ctrl ctrl;
-       u32 ret;
+       int ret;
 
        ctrl.type = qempty->dle_type;
        ctrl.target = DLE_DFI_TYPE_QEMPTY;
@@ -986,7 +986,7 @@ static int hfc_upd_ch_info(struct rtw89_dev *rtwdev, u8 ch)
        struct rtw89_hfc_ch_info *info = param->ch_info;
        const struct rtw89_hfc_ch_cfg *cfg = param->ch_cfg;
        u32 val;
-       u32 ret;
+       int ret;
 
        ret = rtw89_mac_check_mac_en(rtwdev, RTW89_MAC_0, RTW89_DMAC_SEL);
        if (ret)
@@ -1177,8 +1177,8 @@ int rtw89_mac_hfc_init(struct rtw89_dev *rtwdev, bool reset, bool en, bool h2c_e
        const struct rtw89_mac_gen_def *mac = rtwdev->chip->mac_def;
        const struct rtw89_chip_info *chip = rtwdev->chip;
        u32 dma_ch_mask = chip->dma_ch_mask;
+       int ret = 0;
        u8 ch;
-       u32 ret = 0;
 
        if (reset)
                ret = hfc_reset_param(rtwdev);
@@ -1194,7 +1194,7 @@ int rtw89_mac_hfc_init(struct rtw89_dev *rtwdev, bool reset, bool en, bool h2c_e
        if (!en && h2c_en) {
                mac->hfc_h2c_cfg(rtwdev);
                mac->hfc_func_en(rtwdev, en, h2c_en);
-               return ret;
+               return 0;
        }
 
        for (ch = RTW89_DMA_ACH0; ch < RTW89_DMA_H2C; ch++) {
@@ -2414,7 +2414,7 @@ static int addr_cam_init_ax(struct rtw89_dev *rtwdev, u8 mac_idx)
 
 static int scheduler_init_ax(struct rtw89_dev *rtwdev, u8 mac_idx)
 {
-       u32 ret;
+       int ret;
        u32 reg;
        u32 val;
 
@@ -2955,7 +2955,7 @@ static int rtw89_mac_read_phycap(struct rtw89_dev *rtwdev,
        struct rtw89_mac_h2c_info h2c_info = {};
        enum rtw89_mac_c2h_type c2h_type;
        u8 content_len;
-       u32 ret;
+       int ret;
 
        if (chip->chip_gen == RTW89_CHIP_AX)
                content_len = 0;
@@ -3106,10 +3106,10 @@ int rtw89_mac_setup_phycap(struct rtw89_dev *rtwdev)
 static int rtw89_hw_sch_tx_en_h2c(struct rtw89_dev *rtwdev, u8 band,
                                  u16 tx_en_u16, u16 mask_u16)
 {
-       u32 ret;
        struct rtw89_mac_c2h_info c2h_info = {0};
        struct rtw89_mac_h2c_info h2c_info = {0};
        struct rtw89_h2creg_sch_tx_en *sch_tx_en = &h2c_info.u.sch_tx_en;
+       int ret;
 
        h2c_info.id = RTW89_FWCMD_H2CREG_FUNC_SCH_TX_EN;
        h2c_info.content_len = sizeof(*sch_tx_en) - RTW89_H2CREG_HDR_LEN;
@@ -6738,7 +6738,7 @@ int rtw89_mac_set_hw_muedca_ctrl(struct rtw89_dev *rtwdev,
        u8 mac_idx = rtwvif_link->mac_idx;
        u16 set = mac->muedca_ctrl.mask;
        u32 reg;
-       u32 ret;
+       int ret;
 
        ret = rtw89_mac_check_mac_en(rtwdev, mac_idx, RTW89_CMAC_SEL);
        if (ret)
@@ -6880,7 +6880,7 @@ int rtw89_mac_cpu_io_rx(struct rtw89_dev *rtwdev, bool wow_enable)
 {
        struct rtw89_mac_h2c_info h2c_info = {};
        struct rtw89_mac_c2h_info c2h_info = {};
-       u32 ret;
+       int ret;
 
        if (RTW89_CHK_FW_FEATURE(NO_WOW_CPU_IO_RX, &rtwdev->fw))
                return 0;
index b0c2ad22cbb3a03d571edd4d01e1cd93e4478a2f..c8286eb842760ae0a008fd2a3bb94bde4232942d 100644 (file)
@@ -2910,7 +2910,7 @@ static int rtw89_pci_poll_rxdma_ch_idle_ax(struct rtw89_dev *rtwdev)
 
 static int rtw89_pci_poll_dma_all_idle(struct rtw89_dev *rtwdev)
 {
-       u32 ret;
+       int ret;
 
        ret = rtw89_pci_poll_txdma_ch_idle_ax(rtwdev);
        if (ret) {
@@ -4396,7 +4396,7 @@ static int rtw89_pci_lv1rst_stop_dma_ax(struct rtw89_dev *rtwdev)
 
 static int rtw89_pci_lv1rst_start_dma_ax(struct rtw89_dev *rtwdev)
 {
-       u32 ret;
+       int ret;
 
        if (rtwdev->chip->chip_id == RTL8852C)
                return 0;
@@ -4410,7 +4410,7 @@ static int rtw89_pci_lv1rst_start_dma_ax(struct rtw89_dev *rtwdev)
                return ret;
 
        rtw89_pci_ctrl_dma_all(rtwdev, true);
-       return ret;
+       return 0;
 }
 
 static int rtw89_pci_ops_mac_lv1_recovery(struct rtw89_dev *rtwdev,