Commit 2c08fe64 authored by Nilesh Javali's avatar Nilesh Javali Committed by Martin K. Petersen

scsi: qedi: Cleanup local str variable

Signed-off-by: default avatarNilesh Javali <nilesh.javali@cavium.com>
Reviewed-by: default avatarBart Van Assche <bart.vanassche@wdc.com>
Acked-by: default avatarChris Leech <cleech@redhat.com>
Acked-by: default avatarLee Duncan <lduncan@suse.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent 1683ce57
...@@ -1723,7 +1723,6 @@ static ssize_t qedi_show_boot_eth_info(void *data, int type, char *buf) ...@@ -1723,7 +1723,6 @@ static ssize_t qedi_show_boot_eth_info(void *data, int type, char *buf)
{ {
struct qedi_ctx *qedi = data; struct qedi_ctx *qedi = data;
struct nvm_iscsi_initiator *initiator; struct nvm_iscsi_initiator *initiator;
char *str = buf;
int rc = 1; int rc = 1;
u32 ipv6_en, dhcp_en, ip_len; u32 ipv6_en, dhcp_en, ip_len;
struct nvm_iscsi_block *block; struct nvm_iscsi_block *block;
...@@ -1757,32 +1756,32 @@ static ssize_t qedi_show_boot_eth_info(void *data, int type, char *buf) ...@@ -1757,32 +1756,32 @@ static ssize_t qedi_show_boot_eth_info(void *data, int type, char *buf)
switch (type) { switch (type) {
case ISCSI_BOOT_ETH_IP_ADDR: case ISCSI_BOOT_ETH_IP_ADDR:
rc = snprintf(str, ip_len, fmt, ip); rc = snprintf(buf, ip_len, fmt, ip);
break; break;
case ISCSI_BOOT_ETH_SUBNET_MASK: case ISCSI_BOOT_ETH_SUBNET_MASK:
rc = snprintf(str, ip_len, fmt, sub); rc = snprintf(buf, ip_len, fmt, sub);
break; break;
case ISCSI_BOOT_ETH_GATEWAY: case ISCSI_BOOT_ETH_GATEWAY:
rc = snprintf(str, ip_len, fmt, gw); rc = snprintf(buf, ip_len, fmt, gw);
break; break;
case ISCSI_BOOT_ETH_FLAGS: case ISCSI_BOOT_ETH_FLAGS:
rc = snprintf(str, 3, "%hhd\n", rc = snprintf(buf, 3, "%hhd\n",
SYSFS_FLAG_FW_SEL_BOOT); SYSFS_FLAG_FW_SEL_BOOT);
break; break;
case ISCSI_BOOT_ETH_INDEX: case ISCSI_BOOT_ETH_INDEX:
rc = snprintf(str, 3, "0\n"); rc = snprintf(buf, 3, "0\n");
break; break;
case ISCSI_BOOT_ETH_MAC: case ISCSI_BOOT_ETH_MAC:
rc = sysfs_format_mac(str, qedi->mac, ETH_ALEN); rc = sysfs_format_mac(buf, qedi->mac, ETH_ALEN);
break; break;
case ISCSI_BOOT_ETH_VLAN: case ISCSI_BOOT_ETH_VLAN:
rc = snprintf(str, 12, "%d\n", rc = snprintf(buf, 12, "%d\n",
GET_FIELD2(initiator->generic_cont0, GET_FIELD2(initiator->generic_cont0,
NVM_ISCSI_CFG_INITIATOR_VLAN)); NVM_ISCSI_CFG_INITIATOR_VLAN));
break; break;
case ISCSI_BOOT_ETH_ORIGIN: case ISCSI_BOOT_ETH_ORIGIN:
if (dhcp_en) if (dhcp_en)
rc = snprintf(str, 3, "3\n"); rc = snprintf(buf, 3, "3\n");
break; break;
default: default:
rc = 0; rc = 0;
...@@ -1818,7 +1817,6 @@ static ssize_t qedi_show_boot_ini_info(void *data, int type, char *buf) ...@@ -1818,7 +1817,6 @@ static ssize_t qedi_show_boot_ini_info(void *data, int type, char *buf)
{ {
struct qedi_ctx *qedi = data; struct qedi_ctx *qedi = data;
struct nvm_iscsi_initiator *initiator; struct nvm_iscsi_initiator *initiator;
char *str = buf;
int rc; int rc;
struct nvm_iscsi_block *block; struct nvm_iscsi_block *block;
...@@ -1830,7 +1828,7 @@ static ssize_t qedi_show_boot_ini_info(void *data, int type, char *buf) ...@@ -1830,7 +1828,7 @@ static ssize_t qedi_show_boot_ini_info(void *data, int type, char *buf)
switch (type) { switch (type) {
case ISCSI_BOOT_INI_INITIATOR_NAME: case ISCSI_BOOT_INI_INITIATOR_NAME:
rc = sprintf(str, "%.*s\n", NVM_ISCSI_CFG_ISCSI_NAME_MAX_LEN, rc = sprintf(buf, "%.*s\n", NVM_ISCSI_CFG_ISCSI_NAME_MAX_LEN,
initiator->initiator_name.byte); initiator->initiator_name.byte);
break; break;
default: default:
...@@ -1859,7 +1857,6 @@ static ssize_t ...@@ -1859,7 +1857,6 @@ static ssize_t
qedi_show_boot_tgt_info(struct qedi_ctx *qedi, int type, qedi_show_boot_tgt_info(struct qedi_ctx *qedi, int type,
char *buf, enum qedi_nvm_tgts idx) char *buf, enum qedi_nvm_tgts idx)
{ {
char *str = buf;
int rc = 1; int rc = 1;
u32 ctrl_flags, ipv6_en, chap_en, mchap_en, ip_len; u32 ctrl_flags, ipv6_en, chap_en, mchap_en, ip_len;
struct nvm_iscsi_block *block; struct nvm_iscsi_block *block;
...@@ -1898,48 +1895,48 @@ qedi_show_boot_tgt_info(struct qedi_ctx *qedi, int type, ...@@ -1898,48 +1895,48 @@ qedi_show_boot_tgt_info(struct qedi_ctx *qedi, int type,
switch (type) { switch (type) {
case ISCSI_BOOT_TGT_NAME: case ISCSI_BOOT_TGT_NAME:
rc = sprintf(str, "%.*s\n", NVM_ISCSI_CFG_ISCSI_NAME_MAX_LEN, rc = sprintf(buf, "%.*s\n", NVM_ISCSI_CFG_ISCSI_NAME_MAX_LEN,
block->target[idx].target_name.byte); block->target[idx].target_name.byte);
break; break;
case ISCSI_BOOT_TGT_IP_ADDR: case ISCSI_BOOT_TGT_IP_ADDR:
if (ipv6_en) if (ipv6_en)
rc = snprintf(str, ip_len, "%pI6\n", rc = snprintf(buf, ip_len, "%pI6\n",
block->target[idx].ipv6_addr.byte); block->target[idx].ipv6_addr.byte);
else else
rc = snprintf(str, ip_len, "%pI4\n", rc = snprintf(buf, ip_len, "%pI4\n",
block->target[idx].ipv4_addr.byte); block->target[idx].ipv4_addr.byte);
break; break;
case ISCSI_BOOT_TGT_PORT: case ISCSI_BOOT_TGT_PORT:
rc = snprintf(str, 12, "%d\n", rc = snprintf(buf, 12, "%d\n",
GET_FIELD2(block->target[idx].generic_cont0, GET_FIELD2(block->target[idx].generic_cont0,
NVM_ISCSI_CFG_TARGET_TCP_PORT)); NVM_ISCSI_CFG_TARGET_TCP_PORT));
break; break;
case ISCSI_BOOT_TGT_LUN: case ISCSI_BOOT_TGT_LUN:
rc = snprintf(str, 22, "%.*d\n", rc = snprintf(buf, 22, "%.*d\n",
block->target[idx].lun.value[1], block->target[idx].lun.value[1],
block->target[idx].lun.value[0]); block->target[idx].lun.value[0]);
break; break;
case ISCSI_BOOT_TGT_CHAP_NAME: case ISCSI_BOOT_TGT_CHAP_NAME:
rc = sprintf(str, "%.*s\n", NVM_ISCSI_CFG_CHAP_NAME_MAX_LEN, rc = sprintf(buf, "%.*s\n", NVM_ISCSI_CFG_CHAP_NAME_MAX_LEN,
chap_name); chap_name);
break; break;
case ISCSI_BOOT_TGT_CHAP_SECRET: case ISCSI_BOOT_TGT_CHAP_SECRET:
rc = sprintf(str, "%.*s\n", NVM_ISCSI_CFG_CHAP_NAME_MAX_LEN, rc = sprintf(buf, "%.*s\n", NVM_ISCSI_CFG_CHAP_NAME_MAX_LEN,
chap_secret); chap_secret);
break; break;
case ISCSI_BOOT_TGT_REV_CHAP_NAME: case ISCSI_BOOT_TGT_REV_CHAP_NAME:
rc = sprintf(str, "%.*s\n", NVM_ISCSI_CFG_CHAP_NAME_MAX_LEN, rc = sprintf(buf, "%.*s\n", NVM_ISCSI_CFG_CHAP_NAME_MAX_LEN,
mchap_name); mchap_name);
break; break;
case ISCSI_BOOT_TGT_REV_CHAP_SECRET: case ISCSI_BOOT_TGT_REV_CHAP_SECRET:
rc = sprintf(str, "%.*s\n", NVM_ISCSI_CFG_CHAP_NAME_MAX_LEN, rc = sprintf(buf, "%.*s\n", NVM_ISCSI_CFG_CHAP_NAME_MAX_LEN,
mchap_secret); mchap_secret);
break; break;
case ISCSI_BOOT_TGT_FLAGS: case ISCSI_BOOT_TGT_FLAGS:
rc = snprintf(str, 3, "%hhd\n", SYSFS_FLAG_FW_SEL_BOOT); rc = snprintf(buf, 3, "%hhd\n", SYSFS_FLAG_FW_SEL_BOOT);
break; break;
case ISCSI_BOOT_TGT_NIC_ASSOC: case ISCSI_BOOT_TGT_NIC_ASSOC:
rc = snprintf(str, 3, "0\n"); rc = snprintf(buf, 3, "0\n");
break; break;
default: default:
rc = 0; rc = 0;
......
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