qcacmn: Stringify HW_VERSION value when HW UNKNOWN
When new hardware is not found in the lookup table
for human readable hardware names, print the hex
value of the hardware version info.
Change-Id: If821ba04c83f2d9b54587379d92bdc1918d7a094
CRs-Fixed: 1092353
diff --git a/hif/src/hif_main.c b/hif/src/hif_main.c
index c87da4d..6d775ad 100644
--- a/hif/src/hif_main.c
+++ b/hif/src/hif_main.c
@@ -331,6 +331,9 @@
{
int i;
+ if (info->hw_name)
+ return info->hw_name;
+
for (i = 0; i < ARRAY_SIZE(qwlan_hw_list); i++) {
if (info->target_version == qwlan_hw_list[i].id &&
info->target_revision == qwlan_hw_list[i].subid) {
@@ -338,7 +341,16 @@
}
}
- return "Unknown Device";
+ info->hw_name = qdf_mem_malloc(64);
+ if (!info->hw_name)
+ return "Unknown Device (nomem)";
+
+ i = qdf_snprint(info->hw_name, 64, "HW_VERSION=%x.",
+ info->target_version);
+ if (i < 0)
+ return "Unknown Device (snprintf failure)";
+ else
+ return info->hw_name;
}
/**
@@ -449,6 +461,12 @@
scn->athdiag_procfs_inited = false;
}
+ if (scn->target_info.hw_name) {
+ char *hw_name = scn->target_info.hw_name;
+ scn->target_info.hw_name = "ErrUnloading";
+ qdf_mem_free(hw_name);
+ }
+
hif_bus_close(scn);
qdf_mem_free(scn);
}