aboutsummaryrefslogtreecommitdiffstats
path: root/package/network/utils/iwinfo/src
diff options
context:
space:
mode:
authorJo-Philipp Wich <jow@openwrt.org>2013-04-28 14:04:39 +0000
committerJo-Philipp Wich <jow@openwrt.org>2013-04-28 14:04:39 +0000
commitfde7fcd36c26e0cbec5a590e36c145285b211f1f (patch)
tree352b061a2a75606470ac0bf378a6de35e059678b /package/network/utils/iwinfo/src
parent9aa9b6b4823d8e28abf4cf9aebf47c65d6ca57a6 (diff)
downloadmaster-187ad058-fde7fcd36c26e0cbec5a590e36c145285b211f1f.tar.gz
master-187ad058-fde7fcd36c26e0cbec5a590e36c145285b211f1f.tar.bz2
master-187ad058-fde7fcd36c26e0cbec5a590e36c145285b211f1f.zip
iwinfo: fix iwinfo_hardware() return value if chip id is not found
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@36471 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'package/network/utils/iwinfo/src')
-rw-r--r--package/network/utils/iwinfo/src/iwinfo_utils.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/package/network/utils/iwinfo/src/iwinfo_utils.c b/package/network/utils/iwinfo/src/iwinfo_utils.c
index b6760c3486..1a831f3ac1 100644
--- a/package/network/utils/iwinfo/src/iwinfo_utils.c
+++ b/package/network/utils/iwinfo/src/iwinfo_utils.c
@@ -131,7 +131,7 @@ struct iwinfo_hardware_entry * iwinfo_hardware(struct iwinfo_hardware_id *id)
{
FILE *db;
char buf[256] = { 0 };
- static struct iwinfo_hardware_entry e;
+ static struct iwinfo_hardware_entry e, *rv = NULL;
if (!(db = fopen(IWINFO_HARDWARE_FILE, "r")))
return NULL;
@@ -161,15 +161,12 @@ struct iwinfo_hardware_entry * iwinfo_hardware(struct iwinfo_hardware_id *id)
(e.subsystem_device_id != id->subsystem_device_id))
continue;
+ rv = &e;
break;
}
fclose(db);
-
- if (e.device_name[0])
- return &e;
-
- return NULL;
+ return rv;
}
int iwinfo_hardware_id_from_mtd(struct iwinfo_hardware_id *id)