aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/wireless/iwlwifi/dvm/agn.h9
-rw-r--r--drivers/net/wireless/iwlwifi/dvm/debugfs.c56
-rw-r--r--drivers/net/wireless/iwlwifi/dvm/main.c12
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-drv.c132
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-op-mode.h3
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-trans.h2
-rw-r--r--drivers/net/wireless/iwlwifi/pcie/drv.c6
-rw-r--r--drivers/net/wireless/iwlwifi/pcie/trans.c6
8 files changed, 166 insertions, 60 deletions
diff --git a/drivers/net/wireless/iwlwifi/dvm/agn.h b/drivers/net/wireless/iwlwifi/dvm/agn.h
index 9bb16bdf6d26..12762dc40409 100644
--- a/drivers/net/wireless/iwlwifi/dvm/agn.h
+++ b/drivers/net/wireless/iwlwifi/dvm/agn.h
@@ -485,16 +485,13 @@ static inline void iwl_dvm_set_pmi(struct iwl_priv *priv, bool state)
485} 485}
486 486
487#ifdef CONFIG_IWLWIFI_DEBUGFS 487#ifdef CONFIG_IWLWIFI_DEBUGFS
488int iwl_dbgfs_register(struct iwl_priv *priv, const char *name); 488int iwl_dbgfs_register(struct iwl_priv *priv, struct dentry *dbgfs_dir);
489void iwl_dbgfs_unregister(struct iwl_priv *priv);
490#else 489#else
491static inline int iwl_dbgfs_register(struct iwl_priv *priv, const char *name) 490static inline int iwl_dbgfs_register(struct iwl_priv *priv,
491 struct dentry *dbgfs_dir)
492{ 492{
493 return 0; 493 return 0;
494} 494}
495static inline void iwl_dbgfs_unregister(struct iwl_priv *priv)
496{
497}
498#endif /* CONFIG_IWLWIFI_DEBUGFS */ 495#endif /* CONFIG_IWLWIFI_DEBUGFS */
499 496
500#ifdef CONFIG_IWLWIFI_DEBUG 497#ifdef CONFIG_IWLWIFI_DEBUG
diff --git a/drivers/net/wireless/iwlwifi/dvm/debugfs.c b/drivers/net/wireless/iwlwifi/dvm/debugfs.c
index 46782f1102ac..ce826bc5f111 100644
--- a/drivers/net/wireless/iwlwifi/dvm/debugfs.c
+++ b/drivers/net/wireless/iwlwifi/dvm/debugfs.c
@@ -2349,24 +2349,19 @@ DEBUGFS_READ_WRITE_FILE_OPS(calib_disabled);
2349 * Create the debugfs files and directories 2349 * Create the debugfs files and directories
2350 * 2350 *
2351 */ 2351 */
2352int iwl_dbgfs_register(struct iwl_priv *priv, const char *name) 2352int iwl_dbgfs_register(struct iwl_priv *priv, struct dentry *dbgfs_dir)
2353{ 2353{
2354 struct dentry *phyd = priv->hw->wiphy->debugfsdir; 2354 struct dentry *dir_data, *dir_rf, *dir_debug;
2355 struct dentry *dir_drv, *dir_data, *dir_rf, *dir_debug;
2356 2355
2357 dir_drv = debugfs_create_dir(name, phyd); 2356 priv->debugfs_dir = dbgfs_dir;
2358 if (!dir_drv)
2359 return -ENOMEM;
2360
2361 priv->debugfs_dir = dir_drv;
2362 2357
2363 dir_data = debugfs_create_dir("data", dir_drv); 2358 dir_data = debugfs_create_dir("data", dbgfs_dir);
2364 if (!dir_data) 2359 if (!dir_data)
2365 goto err; 2360 goto err;
2366 dir_rf = debugfs_create_dir("rf", dir_drv); 2361 dir_rf = debugfs_create_dir("rf", dbgfs_dir);
2367 if (!dir_rf) 2362 if (!dir_rf)
2368 goto err; 2363 goto err;
2369 dir_debug = debugfs_create_dir("debug", dir_drv); 2364 dir_debug = debugfs_create_dir("debug", dbgfs_dir);
2370 if (!dir_debug) 2365 if (!dir_debug)
2371 goto err; 2366 goto err;
2372 2367
@@ -2412,25 +2407,30 @@ int iwl_dbgfs_register(struct iwl_priv *priv, const char *name)
2412 /* Calibrations disabled/enabled status*/ 2407 /* Calibrations disabled/enabled status*/
2413 DEBUGFS_ADD_FILE(calib_disabled, dir_rf, S_IWUSR | S_IRUSR); 2408 DEBUGFS_ADD_FILE(calib_disabled, dir_rf, S_IWUSR | S_IRUSR);
2414 2409
2415 if (iwl_trans_dbgfs_register(priv->trans, dir_debug)) 2410 /*
2416 goto err; 2411 * Create a symlink with mac80211. This is not very robust, as it does
2412 * not remove the symlink created. The implicit assumption is that
2413 * when the opmode exits, mac80211 will also exit, and will remove
2414 * this symlink as part of its cleanup.
2415 */
2416 if (priv->mac80211_registered) {
2417 char buf[100];
2418 struct dentry *mac80211_dir, *dev_dir, *root_dir;
2419
2420 dev_dir = dbgfs_dir->d_parent;
2421 root_dir = dev_dir->d_parent;
2422 mac80211_dir = priv->hw->wiphy->debugfsdir;
2423
2424 snprintf(buf, 100, "../../%s/%s", root_dir->d_name.name,
2425 dev_dir->d_name.name);
2426
2427 if (!debugfs_create_symlink("iwlwifi", mac80211_dir, buf))
2428 goto err;
2429 }
2430
2417 return 0; 2431 return 0;
2418 2432
2419err: 2433err:
2420 IWL_ERR(priv, "Can't create the debugfs directory\n"); 2434 IWL_ERR(priv, "failed to create the dvm debugfs entries\n");
2421 iwl_dbgfs_unregister(priv);
2422 return -ENOMEM; 2435 return -ENOMEM;
2423} 2436}
2424
2425/**
2426 * Remove the debugfs files and directories
2427 *
2428 */
2429void iwl_dbgfs_unregister(struct iwl_priv *priv)
2430{
2431 if (!priv->debugfs_dir)
2432 return;
2433
2434 debugfs_remove_recursive(priv->debugfs_dir);
2435 priv->debugfs_dir = NULL;
2436}
diff --git a/drivers/net/wireless/iwlwifi/dvm/main.c b/drivers/net/wireless/iwlwifi/dvm/main.c
index e8ffbe424b42..ab7b9ed00b8f 100644
--- a/drivers/net/wireless/iwlwifi/dvm/main.c
+++ b/drivers/net/wireless/iwlwifi/dvm/main.c
@@ -1222,7 +1222,8 @@ static int iwl_eeprom_init_hw_params(struct iwl_priv *priv)
1222 1222
1223static struct iwl_op_mode *iwl_op_mode_dvm_start(struct iwl_trans *trans, 1223static struct iwl_op_mode *iwl_op_mode_dvm_start(struct iwl_trans *trans,
1224 const struct iwl_cfg *cfg, 1224 const struct iwl_cfg *cfg,
1225 const struct iwl_fw *fw) 1225 const struct iwl_fw *fw,
1226 struct dentry *dbgfs_dir)
1226{ 1227{
1227 struct iwl_priv *priv; 1228 struct iwl_priv *priv;
1228 struct ieee80211_hw *hw; 1229 struct ieee80211_hw *hw;
@@ -1466,12 +1467,13 @@ static struct iwl_op_mode *iwl_op_mode_dvm_start(struct iwl_trans *trans,
1466 if (iwlagn_mac_setup_register(priv, &fw->ucode_capa)) 1467 if (iwlagn_mac_setup_register(priv, &fw->ucode_capa))
1467 goto out_destroy_workqueue; 1468 goto out_destroy_workqueue;
1468 1469
1469 if (iwl_dbgfs_register(priv, DRV_NAME)) 1470 if (iwl_dbgfs_register(priv, dbgfs_dir))
1470 IWL_ERR(priv, 1471 goto out_mac80211_unregister;
1471 "failed to create debugfs files. Ignoring error\n");
1472 1472
1473 return op_mode; 1473 return op_mode;
1474 1474
1475out_mac80211_unregister:
1476 iwlagn_mac_unregister(priv);
1475out_destroy_workqueue: 1477out_destroy_workqueue:
1476 iwl_tt_exit(priv); 1478 iwl_tt_exit(priv);
1477 iwl_testmode_free(priv); 1479 iwl_testmode_free(priv);
@@ -1496,8 +1498,6 @@ static void iwl_op_mode_dvm_stop(struct iwl_op_mode *op_mode)
1496 1498
1497 IWL_DEBUG_INFO(priv, "*** UNLOAD DRIVER ***\n"); 1499 IWL_DEBUG_INFO(priv, "*** UNLOAD DRIVER ***\n");
1498 1500
1499 iwl_dbgfs_unregister(priv);
1500
1501 iwl_testmode_free(priv); 1501 iwl_testmode_free(priv);
1502 iwlagn_mac_unregister(priv); 1502 iwlagn_mac_unregister(priv);
1503 1503
diff --git a/drivers/net/wireless/iwlwifi/iwl-drv.c b/drivers/net/wireless/iwlwifi/iwl-drv.c
index 35a9d65664e9..48d6d44c16d0 100644
--- a/drivers/net/wireless/iwlwifi/iwl-drv.c
+++ b/drivers/net/wireless/iwlwifi/iwl-drv.c
@@ -101,6 +101,10 @@ MODULE_VERSION(DRV_VERSION);
101MODULE_AUTHOR(DRV_COPYRIGHT " " DRV_AUTHOR); 101MODULE_AUTHOR(DRV_COPYRIGHT " " DRV_AUTHOR);
102MODULE_LICENSE("GPL"); 102MODULE_LICENSE("GPL");
103 103
104#ifdef CONFIG_IWLWIFI_DEBUGFS
105static struct dentry *iwl_dbgfs_root;
106#endif
107
104/** 108/**
105 * struct iwl_drv - drv common data 109 * struct iwl_drv - drv common data
106 * @list: list of drv structures using this opmode 110 * @list: list of drv structures using this opmode
@@ -126,6 +130,12 @@ struct iwl_drv {
126 char firmware_name[25]; /* name of firmware file to load */ 130 char firmware_name[25]; /* name of firmware file to load */
127 131
128 struct completion request_firmware_complete; 132 struct completion request_firmware_complete;
133
134#ifdef CONFIG_IWLWIFI_DEBUGFS
135 struct dentry *dbgfs_drv;
136 struct dentry *dbgfs_trans;
137 struct dentry *dbgfs_op_mode;
138#endif
129}; 139};
130 140
131#define DVM_OP_MODE 0 141#define DVM_OP_MODE 0
@@ -760,6 +770,50 @@ static int validate_sec_sizes(struct iwl_drv *drv,
760 return 0; 770 return 0;
761} 771}
762 772
773static struct iwl_op_mode *
774_iwl_op_mode_start(struct iwl_drv *drv, struct iwlwifi_opmode_table *op)
775{
776 const struct iwl_op_mode_ops *ops = op->ops;
777 struct dentry *dbgfs_dir = NULL;
778 struct iwl_op_mode *op_mode = NULL;
779
780#ifdef CONFIG_IWLWIFI_DEBUGFS
781 drv->dbgfs_op_mode = debugfs_create_dir(op->name,
782 drv->dbgfs_drv);
783 if (!drv->dbgfs_op_mode) {
784 IWL_ERR(drv,
785 "failed to create opmode debugfs directory\n");
786 return op_mode;
787 }
788 dbgfs_dir = drv->dbgfs_op_mode;
789#endif
790
791 op_mode = ops->start(drv->trans, drv->cfg, &drv->fw, dbgfs_dir);
792
793#ifdef CONFIG_IWLWIFI_DEBUGFS
794 if (!op_mode) {
795 debugfs_remove_recursive(drv->dbgfs_op_mode);
796 drv->dbgfs_op_mode = NULL;
797 }
798#endif
799
800 return op_mode;
801}
802
803static void _iwl_op_mode_stop(struct iwl_drv *drv)
804{
805 /* op_mode can be NULL if its start failed */
806 if (drv->op_mode) {
807 iwl_op_mode_stop(drv->op_mode);
808 drv->op_mode = NULL;
809
810#ifdef CONFIG_IWLWIFI_DEBUGFS
811 debugfs_remove_recursive(drv->dbgfs_op_mode);
812 drv->dbgfs_op_mode = NULL;
813#endif
814 }
815}
816
763/** 817/**
764 * iwl_req_fw_callback - callback when firmware was loaded 818 * iwl_req_fw_callback - callback when firmware was loaded
765 * 819 *
@@ -909,8 +963,7 @@ static void iwl_req_fw_callback(const struct firmware *ucode_raw, void *context)
909 list_add_tail(&drv->list, &op->drv); 963 list_add_tail(&drv->list, &op->drv);
910 964
911 if (op->ops) { 965 if (op->ops) {
912 const struct iwl_op_mode_ops *ops = op->ops; 966 drv->op_mode = _iwl_op_mode_start(drv, op);
913 drv->op_mode = ops->start(drv->trans, drv->cfg, &drv->fw);
914 967
915 if (!drv->op_mode) { 968 if (!drv->op_mode) {
916 mutex_unlock(&iwlwifi_opmode_table_mtx); 969 mutex_unlock(&iwlwifi_opmode_table_mtx);
@@ -970,24 +1023,51 @@ struct iwl_drv *iwl_drv_start(struct iwl_trans *trans,
970 init_completion(&drv->request_firmware_complete); 1023 init_completion(&drv->request_firmware_complete);
971 INIT_LIST_HEAD(&drv->list); 1024 INIT_LIST_HEAD(&drv->list);
972 1025
1026#ifdef CONFIG_IWLWIFI_DEBUGFS
1027 /* Create the device debugfs entries. */
1028 drv->dbgfs_drv = debugfs_create_dir(dev_name(trans->dev),
1029 iwl_dbgfs_root);
1030
1031 if (!drv->dbgfs_drv) {
1032 IWL_ERR(drv, "failed to create debugfs directory\n");
1033 goto err_free_drv;
1034 }
1035
1036 /* Create transport layer debugfs dir */
1037 drv->trans->dbgfs_dir = debugfs_create_dir("trans", drv->dbgfs_drv);
1038
1039 if (!drv->trans->dbgfs_dir) {
1040 IWL_ERR(drv, "failed to create transport debugfs directory\n");
1041 goto err_free_dbgfs;
1042 }
1043#endif
1044
973 ret = iwl_request_firmware(drv, true); 1045 ret = iwl_request_firmware(drv, true);
974 1046
975 if (ret) { 1047 if (ret) {
976 IWL_ERR(trans, "Couldn't request the fw\n"); 1048 IWL_ERR(trans, "Couldn't request the fw\n");
977 kfree(drv); 1049 goto err_fw;
978 drv = NULL;
979 } 1050 }
980 1051
981 return drv; 1052 return drv;
1053
1054err_fw:
1055#ifdef CONFIG_IWLWIFI_DEBUGFS
1056err_free_dbgfs:
1057 debugfs_remove_recursive(drv->dbgfs_drv);
1058err_free_drv:
1059#endif
1060 kfree(drv);
1061 drv = NULL;
1062
1063 return drv;
982} 1064}
983 1065
984void iwl_drv_stop(struct iwl_drv *drv) 1066void iwl_drv_stop(struct iwl_drv *drv)
985{ 1067{
986 wait_for_completion(&drv->request_firmware_complete); 1068 wait_for_completion(&drv->request_firmware_complete);
987 1069
988 /* op_mode can be NULL if its start failed */ 1070 _iwl_op_mode_stop(drv);
989 if (drv->op_mode)
990 iwl_op_mode_stop(drv->op_mode);
991 1071
992 iwl_dealloc_ucode(drv); 1072 iwl_dealloc_ucode(drv);
993 1073
@@ -1001,6 +1081,10 @@ void iwl_drv_stop(struct iwl_drv *drv)
1001 list_del(&drv->list); 1081 list_del(&drv->list);
1002 mutex_unlock(&iwlwifi_opmode_table_mtx); 1082 mutex_unlock(&iwlwifi_opmode_table_mtx);
1003 1083
1084#ifdef CONFIG_IWLWIFI_DEBUGFS
1085 debugfs_remove_recursive(drv->dbgfs_drv);
1086#endif
1087
1004 kfree(drv); 1088 kfree(drv);
1005} 1089}
1006 1090
@@ -1023,15 +1107,18 @@ int iwl_opmode_register(const char *name, const struct iwl_op_mode_ops *ops)
1023{ 1107{
1024 int i; 1108 int i;
1025 struct iwl_drv *drv; 1109 struct iwl_drv *drv;
1110 struct iwlwifi_opmode_table *op;
1026 1111
1027 mutex_lock(&iwlwifi_opmode_table_mtx); 1112 mutex_lock(&iwlwifi_opmode_table_mtx);
1028 for (i = 0; i < ARRAY_SIZE(iwlwifi_opmode_table); i++) { 1113 for (i = 0; i < ARRAY_SIZE(iwlwifi_opmode_table); i++) {
1029 if (strcmp(iwlwifi_opmode_table[i].name, name)) 1114 op = &iwlwifi_opmode_table[i];
1115 if (strcmp(op->name, name))
1030 continue; 1116 continue;
1031 iwlwifi_opmode_table[i].ops = ops; 1117 op->ops = ops;
1032 list_for_each_entry(drv, &iwlwifi_opmode_table[i].drv, list) 1118 /* TODO: need to handle exceptional case */
1033 drv->op_mode = ops->start(drv->trans, drv->cfg, 1119 list_for_each_entry(drv, &op->drv, list)
1034 &drv->fw); 1120 drv->op_mode = _iwl_op_mode_start(drv, op);
1121
1035 mutex_unlock(&iwlwifi_opmode_table_mtx); 1122 mutex_unlock(&iwlwifi_opmode_table_mtx);
1036 return 0; 1123 return 0;
1037 } 1124 }
@@ -1052,12 +1139,9 @@ void iwl_opmode_deregister(const char *name)
1052 iwlwifi_opmode_table[i].ops = NULL; 1139 iwlwifi_opmode_table[i].ops = NULL;
1053 1140
1054 /* call the stop routine for all devices */ 1141 /* call the stop routine for all devices */
1055 list_for_each_entry(drv, &iwlwifi_opmode_table[i].drv, list) { 1142 list_for_each_entry(drv, &iwlwifi_opmode_table[i].drv, list)
1056 if (drv->op_mode) { 1143 _iwl_op_mode_stop(drv);
1057 iwl_op_mode_stop(drv->op_mode); 1144
1058 drv->op_mode = NULL;
1059 }
1060 }
1061 mutex_unlock(&iwlwifi_opmode_table_mtx); 1145 mutex_unlock(&iwlwifi_opmode_table_mtx);
1062 return; 1146 return;
1063 } 1147 }
@@ -1077,6 +1161,14 @@ static int __init iwl_drv_init(void)
1077 pr_info(DRV_DESCRIPTION ", " DRV_VERSION "\n"); 1161 pr_info(DRV_DESCRIPTION ", " DRV_VERSION "\n");
1078 pr_info(DRV_COPYRIGHT "\n"); 1162 pr_info(DRV_COPYRIGHT "\n");
1079 1163
1164#ifdef CONFIG_IWLWIFI_DEBUGFS
1165 /* Create the root of iwlwifi debugfs subsystem. */
1166 iwl_dbgfs_root = debugfs_create_dir(DRV_NAME, NULL);
1167
1168 if (!iwl_dbgfs_root)
1169 return -EFAULT;
1170#endif
1171
1080 return iwl_pci_register_driver(); 1172 return iwl_pci_register_driver();
1081} 1173}
1082module_init(iwl_drv_init); 1174module_init(iwl_drv_init);
@@ -1084,6 +1176,10 @@ module_init(iwl_drv_init);
1084static void __exit iwl_drv_exit(void) 1176static void __exit iwl_drv_exit(void)
1085{ 1177{
1086 iwl_pci_unregister_driver(); 1178 iwl_pci_unregister_driver();
1179
1180#ifdef CONFIG_IWLWIFI_DEBUGFS
1181 debugfs_remove_recursive(iwl_dbgfs_root);
1182#endif
1087} 1183}
1088module_exit(iwl_drv_exit); 1184module_exit(iwl_drv_exit);
1089 1185
diff --git a/drivers/net/wireless/iwlwifi/iwl-op-mode.h b/drivers/net/wireless/iwlwifi/iwl-op-mode.h
index 64886f95664f..c8d9b9517468 100644
--- a/drivers/net/wireless/iwlwifi/iwl-op-mode.h
+++ b/drivers/net/wireless/iwlwifi/iwl-op-mode.h
@@ -134,7 +134,8 @@ struct iwl_cfg;
134struct iwl_op_mode_ops { 134struct iwl_op_mode_ops {
135 struct iwl_op_mode *(*start)(struct iwl_trans *trans, 135 struct iwl_op_mode *(*start)(struct iwl_trans *trans,
136 const struct iwl_cfg *cfg, 136 const struct iwl_cfg *cfg,
137 const struct iwl_fw *fw); 137 const struct iwl_fw *fw,
138 struct dentry *dbgfs_dir);
138 void (*stop)(struct iwl_op_mode *op_mode); 139 void (*stop)(struct iwl_op_mode *op_mode);
139 int (*rx)(struct iwl_op_mode *op_mode, struct iwl_rx_cmd_buffer *rxb, 140 int (*rx)(struct iwl_op_mode *op_mode, struct iwl_rx_cmd_buffer *rxb,
140 struct iwl_device_cmd *cmd); 141 struct iwl_device_cmd *cmd);
diff --git a/drivers/net/wireless/iwlwifi/iwl-trans.h b/drivers/net/wireless/iwlwifi/iwl-trans.h
index 92576a3e84ef..8ac72a6ef227 100644
--- a/drivers/net/wireless/iwlwifi/iwl-trans.h
+++ b/drivers/net/wireless/iwlwifi/iwl-trans.h
@@ -460,6 +460,8 @@ struct iwl_trans {
460 size_t dev_cmd_headroom; 460 size_t dev_cmd_headroom;
461 char dev_cmd_pool_name[50]; 461 char dev_cmd_pool_name[50];
462 462
463 struct dentry *dbgfs_dir;
464
463 /* pointer to trans specific struct */ 465 /* pointer to trans specific struct */
464 /*Ensure that this pointer will always be aligned to sizeof pointer */ 466 /*Ensure that this pointer will always be aligned to sizeof pointer */
465 char trans_specific[0] __aligned(sizeof(void *)); 467 char trans_specific[0] __aligned(sizeof(void *));
diff --git a/drivers/net/wireless/iwlwifi/pcie/drv.c b/drivers/net/wireless/iwlwifi/pcie/drv.c
index f4c3500b68c6..89bfb43f4946 100644
--- a/drivers/net/wireless/iwlwifi/pcie/drv.c
+++ b/drivers/net/wireless/iwlwifi/pcie/drv.c
@@ -282,8 +282,14 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
282 if (!trans_pcie->drv) 282 if (!trans_pcie->drv)
283 goto out_free_trans; 283 goto out_free_trans;
284 284
285 /* register transport layer debugfs here */
286 if (iwl_trans_dbgfs_register(iwl_trans, iwl_trans->dbgfs_dir))
287 goto out_free_drv;
288
285 return 0; 289 return 0;
286 290
291out_free_drv:
292 iwl_drv_stop(trans_pcie->drv);
287out_free_trans: 293out_free_trans:
288 iwl_trans_pcie_free(iwl_trans); 294 iwl_trans_pcie_free(iwl_trans);
289 pci_set_drvdata(pdev, NULL); 295 pci_set_drvdata(pdev, NULL);
diff --git a/drivers/net/wireless/iwlwifi/pcie/trans.c b/drivers/net/wireless/iwlwifi/pcie/trans.c
index 69bf6156fdf6..02326287ba46 100644
--- a/drivers/net/wireless/iwlwifi/pcie/trans.c
+++ b/drivers/net/wireless/iwlwifi/pcie/trans.c
@@ -1769,7 +1769,7 @@ void iwl_dump_csr(struct iwl_trans *trans)
1769#define DEBUGFS_ADD_FILE(name, parent, mode) do { \ 1769#define DEBUGFS_ADD_FILE(name, parent, mode) do { \
1770 if (!debugfs_create_file(#name, mode, parent, trans, \ 1770 if (!debugfs_create_file(#name, mode, parent, trans, \
1771 &iwl_dbgfs_##name##_ops)) \ 1771 &iwl_dbgfs_##name##_ops)) \
1772 return -ENOMEM; \ 1772 goto err; \
1773} while (0) 1773} while (0)
1774 1774
1775/* file operation */ 1775/* file operation */
@@ -2033,6 +2033,10 @@ static int iwl_trans_pcie_dbgfs_register(struct iwl_trans *trans,
2033 DEBUGFS_ADD_FILE(fh_reg, dir, S_IRUSR); 2033 DEBUGFS_ADD_FILE(fh_reg, dir, S_IRUSR);
2034 DEBUGFS_ADD_FILE(fw_restart, dir, S_IWUSR); 2034 DEBUGFS_ADD_FILE(fw_restart, dir, S_IWUSR);
2035 return 0; 2035 return 0;
2036
2037err:
2038 IWL_ERR(trans, "failed to create the trans debugfs entry\n");
2039 return -ENOMEM;
2036} 2040}
2037#else 2041#else
2038static int iwl_trans_pcie_dbgfs_register(struct iwl_trans *trans, 2042static int iwl_trans_pcie_dbgfs_register(struct iwl_trans *trans,