Commit 937c397e authored by Wey-Yi Guy's avatar Wey-Yi Guy Committed by John W. Linville

iwlwifi: correct return code for log_event

When dumping event log in debugfs, iwl_dump_nic_event_log()
should return the correct error code instead of let the calling
function makes it own assumption.
Signed-off-by: default avatarWey-Yi Guy <wey-yi.w.guy@intel.com>
Signed-off-by: default avatarReinette Chatre <reinette.chatre@intel.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 11fc5249
...@@ -1965,7 +1965,7 @@ int iwl_dump_nic_event_log(struct iwl_priv *priv, bool full_log, ...@@ -1965,7 +1965,7 @@ int iwl_dump_nic_event_log(struct iwl_priv *priv, bool full_log,
IWL_ERR(priv, IWL_ERR(priv,
"Invalid event log pointer 0x%08X for %s uCode\n", "Invalid event log pointer 0x%08X for %s uCode\n",
base, (priv->ucode_type == UCODE_INIT) ? "Init" : "RT"); base, (priv->ucode_type == UCODE_INIT) ? "Init" : "RT");
return pos; return -EINVAL;
} }
/* event log header */ /* event log header */
...@@ -2013,7 +2013,7 @@ int iwl_dump_nic_event_log(struct iwl_priv *priv, bool full_log, ...@@ -2013,7 +2013,7 @@ int iwl_dump_nic_event_log(struct iwl_priv *priv, bool full_log,
bufsz = size * 48; bufsz = size * 48;
*buf = kmalloc(bufsz, GFP_KERNEL); *buf = kmalloc(bufsz, GFP_KERNEL);
if (!*buf) if (!*buf)
return pos; return -ENOMEM;
} }
if ((iwl_get_debug_level(priv) & IWL_DL_FW_ERRORS) || full_log) { if ((iwl_get_debug_level(priv) & IWL_DL_FW_ERRORS) || full_log) {
/* /*
......
...@@ -429,8 +429,9 @@ static ssize_t iwl_dbgfs_log_event_read(struct file *file, ...@@ -429,8 +429,9 @@ static ssize_t iwl_dbgfs_log_event_read(struct file *file,
int pos = 0; int pos = 0;
ssize_t ret = -ENOMEM; ssize_t ret = -ENOMEM;
pos = priv->cfg->ops->lib->dump_nic_event_log(priv, true, &buf, true); ret = pos = priv->cfg->ops->lib->dump_nic_event_log(
if (pos && buf) { priv, true, &buf, true);
if (buf) {
ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos); ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos);
kfree(buf); kfree(buf);
} }
......
...@@ -1644,7 +1644,7 @@ int iwl3945_dump_nic_event_log(struct iwl_priv *priv, bool full_log, ...@@ -1644,7 +1644,7 @@ int iwl3945_dump_nic_event_log(struct iwl_priv *priv, bool full_log,
base = le32_to_cpu(priv->card_alive.log_event_table_ptr); base = le32_to_cpu(priv->card_alive.log_event_table_ptr);
if (!iwl3945_hw_valid_rtc_data_addr(base)) { if (!iwl3945_hw_valid_rtc_data_addr(base)) {
IWL_ERR(priv, "Invalid event log pointer 0x%08X\n", base); IWL_ERR(priv, "Invalid event log pointer 0x%08X\n", base);
return pos; return -EINVAL;
} }
/* event log header */ /* event log header */
...@@ -1693,7 +1693,7 @@ int iwl3945_dump_nic_event_log(struct iwl_priv *priv, bool full_log, ...@@ -1693,7 +1693,7 @@ int iwl3945_dump_nic_event_log(struct iwl_priv *priv, bool full_log,
bufsz = size * 48; bufsz = size * 48;
*buf = kmalloc(bufsz, GFP_KERNEL); *buf = kmalloc(bufsz, GFP_KERNEL);
if (!*buf) if (!*buf)
return pos; return -ENOMEM;
} }
if ((iwl_get_debug_level(priv) & IWL_DL_FW_ERRORS) || full_log) { if ((iwl_get_debug_level(priv) & IWL_DL_FW_ERRORS) || full_log) {
/* if uCode has wrapped back to top of log, /* if uCode has wrapped back to top of log,
......
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