aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi/pcie/trans.c
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2014-01-21 15:19:18 -0500
committerEmmanuel Grumbach <emmanuel.grumbach@intel.com>2014-02-03 15:23:32 -0500
commit56c2477f23c3bb3aa33516301b3eab0efe05bbe1 (patch)
treec306609826e667e7735763a28a6144eb0988e71f /drivers/net/wireless/iwlwifi/pcie/trans.c
parent189fa2faac49bce07c6c6d83eca21cbe5bf47411 (diff)
iwlwifi: pcie: make FH debugfs file code easier to understand
The code seems fine, as buf won't be assigned when an error is returned, but checking for the error first is easier to understand. Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Diffstat (limited to 'drivers/net/wireless/iwlwifi/pcie/trans.c')
-rw-r--r--drivers/net/wireless/iwlwifi/pcie/trans.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/drivers/net/wireless/iwlwifi/pcie/trans.c b/drivers/net/wireless/iwlwifi/pcie/trans.c
index 7290f422be65..61ae1af34f17 100644
--- a/drivers/net/wireless/iwlwifi/pcie/trans.c
+++ b/drivers/net/wireless/iwlwifi/pcie/trans.c
@@ -1434,16 +1434,15 @@ static ssize_t iwl_dbgfs_fh_reg_read(struct file *file,
1434{ 1434{
1435 struct iwl_trans *trans = file->private_data; 1435 struct iwl_trans *trans = file->private_data;
1436 char *buf = NULL; 1436 char *buf = NULL;
1437 int pos = 0; 1437 ssize_t ret;
1438 ssize_t ret = -EFAULT;
1439
1440 ret = pos = iwl_dump_fh(trans, &buf);
1441 if (buf) {
1442 ret = simple_read_from_buffer(user_buf,
1443 count, ppos, buf, pos);
1444 kfree(buf);
1445 }
1446 1438
1439 ret = iwl_dump_fh(trans, &buf);
1440 if (ret < 0)
1441 return ret;
1442 if (!buf)
1443 return -EINVAL;
1444 ret = simple_read_from_buffer(user_buf, count, ppos, buf, ret);
1445 kfree(buf);
1447 return ret; 1446 return ret;
1448} 1447}
1449 1448