aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNilesh Javali <nilesh.javali@cavium.com>2018-02-07 11:12:36 -0500
committerMartin K. Petersen <martin.petersen@oracle.com>2018-02-13 21:35:40 -0500
commit2c08fe64e4f3b8528f6880b2bd7a66cce6fbcec3 (patch)
tree3a697fad8507e2169eb1ad3b6d4e911c439ff516
parent1683ce57f568c7c92d53e9234624a53554a29cd5 (diff)
scsi: qedi: Cleanup local str variable
Signed-off-by: Nilesh Javali <nilesh.javali@cavium.com> Reviewed-by: Bart Van Assche <bart.vanassche@wdc.com> Acked-by: Chris Leech <cleech@redhat.com> Acked-by: Lee Duncan <lduncan@suse.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
-rw-r--r--drivers/scsi/qedi/qedi_main.c43
1 files changed, 20 insertions, 23 deletions
diff --git a/drivers/scsi/qedi/qedi_main.c b/drivers/scsi/qedi/qedi_main.c
index 7c05be680b94..8b637d1fe5a4 100644
--- a/drivers/scsi/qedi/qedi_main.c
+++ b/drivers/scsi/qedi/qedi_main.c
@@ -1723,7 +1723,6 @@ static ssize_t qedi_show_boot_eth_info(void *data, int type, char *buf)
1723{ 1723{
1724 struct qedi_ctx *qedi = data; 1724 struct qedi_ctx *qedi = data;
1725 struct nvm_iscsi_initiator *initiator; 1725 struct nvm_iscsi_initiator *initiator;
1726 char *str = buf;
1727 int rc = 1; 1726 int rc = 1;
1728 u32 ipv6_en, dhcp_en, ip_len; 1727 u32 ipv6_en, dhcp_en, ip_len;
1729 struct nvm_iscsi_block *block; 1728 struct nvm_iscsi_block *block;
@@ -1757,32 +1756,32 @@ static ssize_t qedi_show_boot_eth_info(void *data, int type, char *buf)
1757 1756
1758 switch (type) { 1757 switch (type) {
1759 case ISCSI_BOOT_ETH_IP_ADDR: 1758 case ISCSI_BOOT_ETH_IP_ADDR:
1760 rc = snprintf(str, ip_len, fmt, ip); 1759 rc = snprintf(buf, ip_len, fmt, ip);
1761 break; 1760 break;
1762 case ISCSI_BOOT_ETH_SUBNET_MASK: 1761 case ISCSI_BOOT_ETH_SUBNET_MASK:
1763 rc = snprintf(str, ip_len, fmt, sub); 1762 rc = snprintf(buf, ip_len, fmt, sub);
1764 break; 1763 break;
1765 case ISCSI_BOOT_ETH_GATEWAY: 1764 case ISCSI_BOOT_ETH_GATEWAY:
1766 rc = snprintf(str, ip_len, fmt, gw); 1765 rc = snprintf(buf, ip_len, fmt, gw);
1767 break; 1766 break;
1768 case ISCSI_BOOT_ETH_FLAGS: 1767 case ISCSI_BOOT_ETH_FLAGS:
1769 rc = snprintf(str, 3, "%hhd\n", 1768 rc = snprintf(buf, 3, "%hhd\n",
1770 SYSFS_FLAG_FW_SEL_BOOT); 1769 SYSFS_FLAG_FW_SEL_BOOT);
1771 break; 1770 break;
1772 case ISCSI_BOOT_ETH_INDEX: 1771 case ISCSI_BOOT_ETH_INDEX:
1773 rc = snprintf(str, 3, "0\n"); 1772 rc = snprintf(buf, 3, "0\n");
1774 break; 1773 break;
1775 case ISCSI_BOOT_ETH_MAC: 1774 case ISCSI_BOOT_ETH_MAC:
1776 rc = sysfs_format_mac(str, qedi->mac, ETH_ALEN); 1775 rc = sysfs_format_mac(buf, qedi->mac, ETH_ALEN);
1777 break; 1776 break;
1778 case ISCSI_BOOT_ETH_VLAN: 1777 case ISCSI_BOOT_ETH_VLAN:
1779 rc = snprintf(str, 12, "%d\n", 1778 rc = snprintf(buf, 12, "%d\n",
1780 GET_FIELD2(initiator->generic_cont0, 1779 GET_FIELD2(initiator->generic_cont0,
1781 NVM_ISCSI_CFG_INITIATOR_VLAN)); 1780 NVM_ISCSI_CFG_INITIATOR_VLAN));
1782 break; 1781 break;
1783 case ISCSI_BOOT_ETH_ORIGIN: 1782 case ISCSI_BOOT_ETH_ORIGIN:
1784 if (dhcp_en) 1783 if (dhcp_en)
1785 rc = snprintf(str, 3, "3\n"); 1784 rc = snprintf(buf, 3, "3\n");
1786 break; 1785 break;
1787 default: 1786 default:
1788 rc = 0; 1787 rc = 0;
@@ -1818,7 +1817,6 @@ static ssize_t qedi_show_boot_ini_info(void *data, int type, char *buf)
1818{ 1817{
1819 struct qedi_ctx *qedi = data; 1818 struct qedi_ctx *qedi = data;
1820 struct nvm_iscsi_initiator *initiator; 1819 struct nvm_iscsi_initiator *initiator;
1821 char *str = buf;
1822 int rc; 1820 int rc;
1823 struct nvm_iscsi_block *block; 1821 struct nvm_iscsi_block *block;
1824 1822
@@ -1830,7 +1828,7 @@ static ssize_t qedi_show_boot_ini_info(void *data, int type, char *buf)
1830 1828
1831 switch (type) { 1829 switch (type) {
1832 case ISCSI_BOOT_INI_INITIATOR_NAME: 1830 case ISCSI_BOOT_INI_INITIATOR_NAME:
1833 rc = sprintf(str, "%.*s\n", NVM_ISCSI_CFG_ISCSI_NAME_MAX_LEN, 1831 rc = sprintf(buf, "%.*s\n", NVM_ISCSI_CFG_ISCSI_NAME_MAX_LEN,
1834 initiator->initiator_name.byte); 1832 initiator->initiator_name.byte);
1835 break; 1833 break;
1836 default: 1834 default:
@@ -1859,7 +1857,6 @@ static ssize_t
1859qedi_show_boot_tgt_info(struct qedi_ctx *qedi, int type, 1857qedi_show_boot_tgt_info(struct qedi_ctx *qedi, int type,
1860 char *buf, enum qedi_nvm_tgts idx) 1858 char *buf, enum qedi_nvm_tgts idx)
1861{ 1859{
1862 char *str = buf;
1863 int rc = 1; 1860 int rc = 1;
1864 u32 ctrl_flags, ipv6_en, chap_en, mchap_en, ip_len; 1861 u32 ctrl_flags, ipv6_en, chap_en, mchap_en, ip_len;
1865 struct nvm_iscsi_block *block; 1862 struct nvm_iscsi_block *block;
@@ -1898,48 +1895,48 @@ qedi_show_boot_tgt_info(struct qedi_ctx *qedi, int type,
1898 1895
1899 switch (type) { 1896 switch (type) {
1900 case ISCSI_BOOT_TGT_NAME: 1897 case ISCSI_BOOT_TGT_NAME:
1901 rc = sprintf(str, "%.*s\n", NVM_ISCSI_CFG_ISCSI_NAME_MAX_LEN, 1898 rc = sprintf(buf, "%.*s\n", NVM_ISCSI_CFG_ISCSI_NAME_MAX_LEN,
1902 block->target[idx].target_name.byte); 1899 block->target[idx].target_name.byte);
1903 break; 1900 break;
1904 case ISCSI_BOOT_TGT_IP_ADDR: 1901 case ISCSI_BOOT_TGT_IP_ADDR:
1905 if (ipv6_en) 1902 if (ipv6_en)
1906 rc = snprintf(str, ip_len, "%pI6\n", 1903 rc = snprintf(buf, ip_len, "%pI6\n",
1907 block->target[idx].ipv6_addr.byte); 1904 block->target[idx].ipv6_addr.byte);
1908 else 1905 else
1909 rc = snprintf(str, ip_len, "%pI4\n", 1906 rc = snprintf(buf, ip_len, "%pI4\n",
1910 block->target[idx].ipv4_addr.byte); 1907 block->target[idx].ipv4_addr.byte);
1911 break; 1908 break;
1912 case ISCSI_BOOT_TGT_PORT: 1909 case ISCSI_BOOT_TGT_PORT:
1913 rc = snprintf(str, 12, "%d\n", 1910 rc = snprintf(buf, 12, "%d\n",
1914 GET_FIELD2(block->target[idx].generic_cont0, 1911 GET_FIELD2(block->target[idx].generic_cont0,
1915 NVM_ISCSI_CFG_TARGET_TCP_PORT)); 1912 NVM_ISCSI_CFG_TARGET_TCP_PORT));
1916 break; 1913 break;
1917 case ISCSI_BOOT_TGT_LUN: 1914 case ISCSI_BOOT_TGT_LUN:
1918 rc = snprintf(str, 22, "%.*d\n", 1915 rc = snprintf(buf, 22, "%.*d\n",
1919 block->target[idx].lun.value[1], 1916 block->target[idx].lun.value[1],
1920 block->target[idx].lun.value[0]); 1917 block->target[idx].lun.value[0]);
1921 break; 1918 break;
1922 case ISCSI_BOOT_TGT_CHAP_NAME: 1919 case ISCSI_BOOT_TGT_CHAP_NAME:
1923 rc = sprintf(str, "%.*s\n", NVM_ISCSI_CFG_CHAP_NAME_MAX_LEN, 1920 rc = sprintf(buf, "%.*s\n", NVM_ISCSI_CFG_CHAP_NAME_MAX_LEN,
1924 chap_name); 1921 chap_name);
1925 break; 1922 break;
1926 case ISCSI_BOOT_TGT_CHAP_SECRET: 1923 case ISCSI_BOOT_TGT_CHAP_SECRET:
1927 rc = sprintf(str, "%.*s\n", NVM_ISCSI_CFG_CHAP_NAME_MAX_LEN, 1924 rc = sprintf(buf, "%.*s\n", NVM_ISCSI_CFG_CHAP_NAME_MAX_LEN,
1928 chap_secret); 1925 chap_secret);
1929 break; 1926 break;
1930 case ISCSI_BOOT_TGT_REV_CHAP_NAME: 1927 case ISCSI_BOOT_TGT_REV_CHAP_NAME:
1931 rc = sprintf(str, "%.*s\n", NVM_ISCSI_CFG_CHAP_NAME_MAX_LEN, 1928 rc = sprintf(buf, "%.*s\n", NVM_ISCSI_CFG_CHAP_NAME_MAX_LEN,
1932 mchap_name); 1929 mchap_name);
1933 break; 1930 break;
1934 case ISCSI_BOOT_TGT_REV_CHAP_SECRET: 1931 case ISCSI_BOOT_TGT_REV_CHAP_SECRET:
1935 rc = sprintf(str, "%.*s\n", NVM_ISCSI_CFG_CHAP_NAME_MAX_LEN, 1932 rc = sprintf(buf, "%.*s\n", NVM_ISCSI_CFG_CHAP_NAME_MAX_LEN,
1936 mchap_secret); 1933 mchap_secret);
1937 break; 1934 break;
1938 case ISCSI_BOOT_TGT_FLAGS: 1935 case ISCSI_BOOT_TGT_FLAGS:
1939 rc = snprintf(str, 3, "%hhd\n", SYSFS_FLAG_FW_SEL_BOOT); 1936 rc = snprintf(buf, 3, "%hhd\n", SYSFS_FLAG_FW_SEL_BOOT);
1940 break; 1937 break;
1941 case ISCSI_BOOT_TGT_NIC_ASSOC: 1938 case ISCSI_BOOT_TGT_NIC_ASSOC:
1942 rc = snprintf(str, 3, "0\n"); 1939 rc = snprintf(buf, 3, "0\n");
1943 break; 1940 break;
1944 default: 1941 default:
1945 rc = 0; 1942 rc = 0;