diff options
author | Dan Carpenter <dan.carpenter@oracle.com> | 2013-01-31 03:17:54 -0500 |
---|---|---|
committer | Nicholas Bellinger <nab@linux-iscsi.org> | 2013-02-13 14:27:51 -0500 |
commit | 07ea81b6f7d6345e146245c4964640a5a27b5cc5 (patch) | |
tree | ac51b8c8445ace138389659e2994fa154b04e426 /drivers/target/iscsi | |
parent | d0c8b259f8970d39354c1966853363345d401330 (diff) |
target: don't always say "ipv6" as address type
"lstat->last_intr_fail_ip_addr" is an array inside the "lstat" struct.
It's never NULL so we always print "ipv6\n" here. The test should be
"if (lstat->last_intr_fail_ip_family == AF_INET6)".
We don't need the temporary buffer either. We could print directly into
"page".
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Diffstat (limited to 'drivers/target/iscsi')
-rw-r--r-- | drivers/target/iscsi/iscsi_target_stat.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/drivers/target/iscsi/iscsi_target_stat.c b/drivers/target/iscsi/iscsi_target_stat.c index 421d6947dc64..54a6f3834cf0 100644 --- a/drivers/target/iscsi/iscsi_target_stat.c +++ b/drivers/target/iscsi/iscsi_target_stat.c | |||
@@ -410,14 +410,16 @@ static ssize_t iscsi_stat_tgt_attr_show_attr_fail_intr_addr_type( | |||
410 | struct iscsi_tiqn *tiqn = container_of(igrps, | 410 | struct iscsi_tiqn *tiqn = container_of(igrps, |
411 | struct iscsi_tiqn, tiqn_stat_grps); | 411 | struct iscsi_tiqn, tiqn_stat_grps); |
412 | struct iscsi_login_stats *lstat = &tiqn->login_stats; | 412 | struct iscsi_login_stats *lstat = &tiqn->login_stats; |
413 | unsigned char buf[8]; | 413 | int ret; |
414 | 414 | ||
415 | spin_lock(&lstat->lock); | 415 | spin_lock(&lstat->lock); |
416 | snprintf(buf, 8, "%s", (lstat->last_intr_fail_ip_addr != NULL) ? | 416 | if (lstat->last_intr_fail_ip_family == AF_INET6) |
417 | "ipv6" : "ipv4"); | 417 | ret = snprintf(page, PAGE_SIZE, "ipv6\n"); |
418 | else | ||
419 | ret = snprintf(page, PAGE_SIZE, "ipv4\n"); | ||
418 | spin_unlock(&lstat->lock); | 420 | spin_unlock(&lstat->lock); |
419 | 421 | ||
420 | return snprintf(page, PAGE_SIZE, "%s\n", buf); | 422 | return ret; |
421 | } | 423 | } |
422 | ISCSI_STAT_TGT_ATTR_RO(fail_intr_addr_type); | 424 | ISCSI_STAT_TGT_ATTR_RO(fail_intr_addr_type); |
423 | 425 | ||