iwinfo: fix iwinfo_hardware() return value if chip id is not found
authorJo-Philipp Wich <jow@openwrt.org>
Sun, 28 Apr 2013 14:04:39 +0000 (14:04 +0000)
committerJo-Philipp Wich <jow@openwrt.org>
Sun, 28 Apr 2013 14:04:39 +0000 (14:04 +0000)
SVN-Revision: 36471

package/network/utils/iwinfo/Makefile
package/network/utils/iwinfo/src/iwinfo_utils.c

index 37586924503af97860bf3d9985964222b43e1e21..e0090e0be5c179b9359f040ba572699be638a45c 100644 (file)
@@ -7,7 +7,7 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=libiwinfo
-PKG_RELEASE:=43
+PKG_RELEASE:=44
 
 PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
 PKG_CONFIG_DEPENDS := \
index b6760c348661d73812e051287d34ea636e4a7848..1a831f3ac14d22ae69b0cfc92f382ee72bb0134f 100644 (file)
@@ -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)