ath6kl: Fix ath6kl_bmi_read_hi32 macro
authorFrederic Danis <frederic.danis@linux.intel.com>
Mon, 2 Jun 2014 18:19:46 +0000 (21:19 +0300)
committerKalle Valo <kvalo@qca.qualcomm.com>
Mon, 14 Jul 2014 12:49:23 +0000 (15:49 +0300)
tmp may be used uninitialized if ath6kl_bmi_read() returns an error.

Signed-off-by: Frederic Danis <frederic.danis@linux.intel.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
drivers/net/wireless/ath/ath6kl/bmi.h
drivers/net/wireless/ath/ath6kl/init.c

index 18fdd69e1f718dfd8eae5551d8fad9131613651f..397a52f2628b74e1f42a63c9a67d93f9c2407ffc 100644 (file)
@@ -242,7 +242,8 @@ struct ath6kl_bmi_target_info {
                (void) (check_type == val);                             \
                addr = ath6kl_get_hi_item_addr(ar, HI_ITEM(item));      \
                ret = ath6kl_bmi_read(ar, addr, (u8 *) &tmp, 4);        \
-               *val = le32_to_cpu(tmp);                                \
+               if (!ret)                                               \
+                       *val = le32_to_cpu(tmp);                        \
                ret;                                                    \
        })
 
index d5ef211f261c2c19e6e8deeef985dc2b83130794..6e1e6995a63498b653321a3a91a1add30746e2bd 100644 (file)
@@ -1161,11 +1161,19 @@ static int ath6kl_upload_board_file(struct ath6kl *ar)
                ath6kl_bmi_write_hi32(ar, hi_board_data,
                                      board_address);
        } else {
-               ath6kl_bmi_read_hi32(ar, hi_board_data, &board_address);
+               ret = ath6kl_bmi_read_hi32(ar, hi_board_data, &board_address);
+               if (ret) {
+                       ath6kl_err("Failed to get board file target address.\n");
+                       return ret;
+               }
        }
 
        /* determine where in target ram to write extended board data */
-       ath6kl_bmi_read_hi32(ar, hi_board_ext_data, &board_ext_address);
+       ret = ath6kl_bmi_read_hi32(ar, hi_board_ext_data, &board_ext_address);
+       if (ret) {
+               ath6kl_err("Failed to get extended board file target address.\n");
+               return ret;
+       }
 
        if (ar->target_type == TARGET_TYPE_AR6003 &&
            board_ext_address == 0) {