Commit 1f55c12c authored by John W. Linville's avatar John W. Linville

iwmc3200wifi: cleanup unneeded debugfs error handling

"iwl: cleanup: remove unneeded error handling" missed the one in
if_sdio_debugfs_init().

I don't think we even need to check -ENODEV ourselves because if
DEBUG_FS is not compiled in, all the debugfs utility functions will
become no-op.
Reported-by: default avatarDan Carpenter <error27@gmail.com>
Signed-off-by: default avatarZhu Yi <yi.zhu@intel.com>
Acked-by: default avatarDan Carpenter <error27@gmail.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent f5c044e5
...@@ -31,7 +31,7 @@ struct iwm_if_ops { ...@@ -31,7 +31,7 @@ struct iwm_if_ops {
int (*disable)(struct iwm_priv *iwm); int (*disable)(struct iwm_priv *iwm);
int (*send_chunk)(struct iwm_priv *iwm, u8* buf, int count); int (*send_chunk)(struct iwm_priv *iwm, u8* buf, int count);
int (*debugfs_init)(struct iwm_priv *iwm, struct dentry *parent_dir); void (*debugfs_init)(struct iwm_priv *iwm, struct dentry *parent_dir);
void (*debugfs_exit)(struct iwm_priv *iwm); void (*debugfs_exit)(struct iwm_priv *iwm);
const char *umac_name; const char *umac_name;
......
...@@ -113,10 +113,10 @@ struct iwm_debugfs { ...@@ -113,10 +113,10 @@ struct iwm_debugfs {
}; };
#ifdef CONFIG_IWM_DEBUG #ifdef CONFIG_IWM_DEBUG
int iwm_debugfs_init(struct iwm_priv *iwm); void iwm_debugfs_init(struct iwm_priv *iwm);
void iwm_debugfs_exit(struct iwm_priv *iwm); void iwm_debugfs_exit(struct iwm_priv *iwm);
#else #else
static inline int iwm_debugfs_init(struct iwm_priv *iwm) static inline void iwm_debugfs_init(struct iwm_priv *iwm)
{ {
return 0; return 0;
} }
......
...@@ -47,12 +47,11 @@ static struct { ...@@ -47,12 +47,11 @@ static struct {
#define add_dbg_module(dbg, name, id, initlevel) \ #define add_dbg_module(dbg, name, id, initlevel) \
do { \ do { \
struct dentry *d; \
dbg.dbg_module[id] = (initlevel); \ dbg.dbg_module[id] = (initlevel); \
d = debugfs_create_x8(name, 0600, dbg.dbgdir, \ dbg.dbg_module_dentries[id] = \
debugfs_create_x8(name, 0600, \
dbg.dbgdir, \
&(dbg.dbg_module[id])); \ &(dbg.dbg_module[id])); \
if (!IS_ERR(d)) \
dbg.dbg_module_dentries[id] = d; \
} while (0) } while (0)
static int iwm_debugfs_u32_read(void *data, u64 *val) static int iwm_debugfs_u32_read(void *data, u64 *val)
...@@ -422,37 +421,19 @@ static const struct file_operations iwm_debugfs_fw_err_fops = { ...@@ -422,37 +421,19 @@ static const struct file_operations iwm_debugfs_fw_err_fops = {
.read = iwm_debugfs_fw_err_read, .read = iwm_debugfs_fw_err_read,
}; };
int iwm_debugfs_init(struct iwm_priv *iwm) void iwm_debugfs_init(struct iwm_priv *iwm)
{ {
int i, result; int i;
char devdir[16];
iwm->dbg.rootdir = debugfs_create_dir(KBUILD_MODNAME, NULL); iwm->dbg.rootdir = debugfs_create_dir(KBUILD_MODNAME, NULL);
result = PTR_ERR(iwm->dbg.rootdir); iwm->dbg.devdir = debugfs_create_dir(wiphy_name(iwm_to_wiphy(iwm)),
if (!result || IS_ERR(iwm->dbg.rootdir)) { iwm->dbg.rootdir);
if (result == -ENODEV) {
IWM_ERR(iwm, "DebugFS (CONFIG_DEBUG_FS) not "
"enabled in kernel config\n");
result = 0; /* No debugfs support */
}
IWM_ERR(iwm, "Couldn't create rootdir: %d\n", result);
goto error;
}
snprintf(devdir, sizeof(devdir), "%s", wiphy_name(iwm_to_wiphy(iwm)));
iwm->dbg.devdir = debugfs_create_dir(devdir, iwm->dbg.rootdir);
iwm->dbg.dbgdir = debugfs_create_dir("debug", iwm->dbg.devdir); iwm->dbg.dbgdir = debugfs_create_dir("debug", iwm->dbg.devdir);
iwm->dbg.rxdir = debugfs_create_dir("rx", iwm->dbg.devdir); iwm->dbg.rxdir = debugfs_create_dir("rx", iwm->dbg.devdir);
iwm->dbg.txdir = debugfs_create_dir("tx", iwm->dbg.devdir); iwm->dbg.txdir = debugfs_create_dir("tx", iwm->dbg.devdir);
iwm->dbg.busdir = debugfs_create_dir("bus", iwm->dbg.devdir); iwm->dbg.busdir = debugfs_create_dir("bus", iwm->dbg.devdir);
if (iwm->bus_ops->debugfs_init) { if (iwm->bus_ops->debugfs_init)
result = iwm->bus_ops->debugfs_init(iwm, iwm->dbg.busdir); iwm->bus_ops->debugfs_init(iwm, iwm->dbg.busdir);
if (result < 0) {
IWM_ERR(iwm, "Couldn't create bus entry: %d\n", result);
goto error;
}
}
iwm->dbg.dbg_level = IWM_DL_NONE; iwm->dbg.dbg_level = IWM_DL_NONE;
iwm->dbg.dbg_level_dentry = iwm->dbg.dbg_level_dentry =
...@@ -471,23 +452,15 @@ int iwm_debugfs_init(struct iwm_priv *iwm) ...@@ -471,23 +452,15 @@ int iwm_debugfs_init(struct iwm_priv *iwm)
iwm->dbg.txq_dentry = debugfs_create_file("queues", 0200, iwm->dbg.txq_dentry = debugfs_create_file("queues", 0200,
iwm->dbg.txdir, iwm, iwm->dbg.txdir, iwm,
&iwm_debugfs_txq_fops); &iwm_debugfs_txq_fops);
iwm->dbg.tx_credit_dentry = debugfs_create_file("credits", 0200, iwm->dbg.tx_credit_dentry = debugfs_create_file("credits", 0200,
iwm->dbg.txdir, iwm, iwm->dbg.txdir, iwm,
&iwm_debugfs_tx_credit_fops); &iwm_debugfs_tx_credit_fops);
iwm->dbg.rx_ticket_dentry = debugfs_create_file("tickets", 0200, iwm->dbg.rx_ticket_dentry = debugfs_create_file("tickets", 0200,
iwm->dbg.rxdir, iwm, iwm->dbg.rxdir, iwm,
&iwm_debugfs_rx_ticket_fops); &iwm_debugfs_rx_ticket_fops);
iwm->dbg.fw_err_dentry = debugfs_create_file("last_fw_err", 0200, iwm->dbg.fw_err_dentry = debugfs_create_file("last_fw_err", 0200,
iwm->dbg.dbgdir, iwm, iwm->dbg.dbgdir, iwm,
&iwm_debugfs_fw_err_fops); &iwm_debugfs_fw_err_fops);
return 0;
error:
return result;
} }
void iwm_debugfs_exit(struct iwm_priv *iwm) void iwm_debugfs_exit(struct iwm_priv *iwm)
......
...@@ -365,21 +365,13 @@ static const struct file_operations iwm_debugfs_sdio_fops = { ...@@ -365,21 +365,13 @@ static const struct file_operations iwm_debugfs_sdio_fops = {
.read = iwm_debugfs_sdio_read, .read = iwm_debugfs_sdio_read,
}; };
static int if_sdio_debugfs_init(struct iwm_priv *iwm, struct dentry *parent_dir) static void if_sdio_debugfs_init(struct iwm_priv *iwm, struct dentry *parent_dir)
{ {
int result;
struct iwm_sdio_priv *hw = iwm_to_if_sdio(iwm); struct iwm_sdio_priv *hw = iwm_to_if_sdio(iwm);
hw->cccr_dentry = debugfs_create_file("cccr", 0200, hw->cccr_dentry = debugfs_create_file("cccr", 0200,
parent_dir, iwm, parent_dir, iwm,
&iwm_debugfs_sdio_fops); &iwm_debugfs_sdio_fops);
result = PTR_ERR(hw->cccr_dentry);
if (IS_ERR(hw->cccr_dentry) && (result != -ENODEV)) {
IWM_ERR(iwm, "Couldn't create CCCR entry: %d\n", result);
return result;
}
return 0;
} }
static void if_sdio_debugfs_exit(struct iwm_priv *iwm) static void if_sdio_debugfs_exit(struct iwm_priv *iwm)
...@@ -439,11 +431,7 @@ static int iwm_sdio_probe(struct sdio_func *func, ...@@ -439,11 +431,7 @@ static int iwm_sdio_probe(struct sdio_func *func,
hw = iwm_private(iwm); hw = iwm_private(iwm);
hw->iwm = iwm; hw->iwm = iwm;
ret = iwm_debugfs_init(iwm); iwm_debugfs_init(iwm);
if (ret < 0) {
IWM_ERR(iwm, "Debugfs registration failed\n");
goto if_free;
}
sdio_set_drvdata(func, hw); sdio_set_drvdata(func, hw);
...@@ -472,7 +460,6 @@ static int iwm_sdio_probe(struct sdio_func *func, ...@@ -472,7 +460,6 @@ static int iwm_sdio_probe(struct sdio_func *func,
destroy_workqueue(hw->isr_wq); destroy_workqueue(hw->isr_wq);
debugfs_exit: debugfs_exit:
iwm_debugfs_exit(iwm); iwm_debugfs_exit(iwm);
if_free:
iwm_if_free(iwm); iwm_if_free(iwm);
return ret; return ret;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment