Merge tag 'wireless-drivers-next-for-davem-2019-05-03' of git://git.kernel.org/pub...
[linux-2.6-microblaze.git] / drivers / net / wireless / intel / iwlwifi / iwl-dbg-tlv.c
index 5798f43..ba66f7f 100644 (file)
@@ -5,7 +5,7 @@
  *
  * GPL LICENSE SUMMARY
  *
- * Copyright (C) 2018 Intel Corporation
+ * Copyright (C) 2018 - 2019 Intel Corporation
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of version 2 of the GNU General Public License as
@@ -28,7 +28,7 @@
  *
  * BSD LICENSE
  *
- * Copyright (C) 2018 Intel Corporation
+ * Copyright (C) 2018 - 2019 Intel Corporation
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -73,6 +73,9 @@ void iwl_fw_dbg_copy_tlv(struct iwl_trans *trans, struct iwl_ucode_tlv *tlv,
        int copy_size = le32_to_cpu(tlv->length) + sizeof(*tlv);
        int offset_size = copy_size;
 
+       if (le32_to_cpu(header->tlv_version) != 1)
+               return;
+
        if (WARN_ONCE(apply_point >= IWL_FW_INI_APPLY_NUM,
                      "Invalid apply point id %d\n", apply_point))
                return;
@@ -126,13 +129,17 @@ void iwl_alloc_dbg_tlv(struct iwl_trans *trans, size_t len, const u8 *data,
                len -= ALIGN(tlv_len, 4);
                data += sizeof(*tlv) + ALIGN(tlv_len, 4);
 
-               if (!(tlv_type & IWL_UCODE_INI_TLV_GROUP))
+               if (tlv_type < IWL_UCODE_TLV_DEBUG_BASE ||
+                   tlv_type > IWL_UCODE_TLV_DEBUG_MAX)
                        continue;
 
                hdr = (void *)&tlv->data[0];
                apply = le32_to_cpu(hdr->apply_point);
 
-               IWL_DEBUG_FW(trans, "Read TLV %x, apply point %d\n",
+               if (le32_to_cpu(hdr->tlv_version) != 1)
+                       continue;
+
+               IWL_DEBUG_FW(trans, "WRT: read TLV 0x%x, apply point %d\n",
                             le32_to_cpu(tlv->type), apply);
 
                if (WARN_ON(apply >= IWL_FW_INI_APPLY_NUM))