[<prev] [next>] [day] [month] [year] [list]
Message-ID: <202212291204.2bs554iQ-lkp@intel.com>
Date: Thu, 29 Dec 2022 12:59:53 +0800
From: kernel test robot <lkp@...el.com>
To: Justin Tee <justin.tee@...adcom.com>
Cc: oe-kbuild-all@...ts.linux.dev, linux-kernel@...r.kernel.org,
"Martin K. Petersen" <martin.petersen@...cle.com>
Subject: drivers/scsi/lpfc/lpfc_attr.c:1944 lpfc_xcvr_data_show() warn:
inconsistent indenting
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 1b929c02afd37871d5afb9d498426f83432e71c2
commit: 479b0917e4477f49df2e3be454aac3cfa5dec171 scsi: lpfc: Create a sysfs entry called lpfc_xcvr_data for transceiver info
date: 10 weeks ago
config: powerpc-randconfig-m031-20221226
compiler: powerpc-linux-gcc (GCC) 12.1.0
If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@...el.com>
smatch warnings:
drivers/scsi/lpfc/lpfc_attr.c:1944 lpfc_xcvr_data_show() warn: inconsistent indenting
vim +1944 drivers/scsi/lpfc/lpfc_attr.c
1879
1880 static ssize_t
1881 lpfc_xcvr_data_show(struct device *dev, struct device_attribute *attr,
1882 char *buf)
1883 {
1884 struct Scsi_Host *shost = class_to_shost(dev);
1885 struct lpfc_vport *vport = (struct lpfc_vport *)shost->hostdata;
1886 struct lpfc_hba *phba = vport->phba;
1887 int rc;
1888 int len = 0;
1889 struct lpfc_rdp_context *rdp_context;
1890 u16 temperature;
1891 u16 rx_power;
1892 u16 tx_bias;
1893 u16 tx_power;
1894 u16 vcc;
1895 char chbuf[128];
1896 u16 wavelength = 0;
1897 struct sff_trasnceiver_codes_byte7 *trasn_code_byte7;
1898
1899 /* Get transceiver information */
1900 rdp_context = kmalloc(sizeof(*rdp_context), GFP_KERNEL);
1901
1902 rc = lpfc_get_sfp_info_wait(phba, rdp_context);
1903 if (rc) {
1904 len = scnprintf(buf, PAGE_SIZE - len, "SFP info NA:\n");
1905 goto out_free_rdp;
1906 }
1907
1908 strncpy(chbuf, &rdp_context->page_a0[SSF_VENDOR_NAME], 16);
1909 chbuf[16] = 0;
1910
1911 len = scnprintf(buf, PAGE_SIZE - len, "VendorName:\t%s\n", chbuf);
1912 len += scnprintf(buf + len, PAGE_SIZE - len,
1913 "VendorOUI:\t%02x-%02x-%02x\n",
1914 (uint8_t)rdp_context->page_a0[SSF_VENDOR_OUI],
1915 (uint8_t)rdp_context->page_a0[SSF_VENDOR_OUI + 1],
1916 (uint8_t)rdp_context->page_a0[SSF_VENDOR_OUI + 2]);
1917 strncpy(chbuf, &rdp_context->page_a0[SSF_VENDOR_PN], 16);
1918 chbuf[16] = 0;
1919 len += scnprintf(buf + len, PAGE_SIZE - len, "VendorPN:\t%s\n", chbuf);
1920 strncpy(chbuf, &rdp_context->page_a0[SSF_VENDOR_SN], 16);
1921 chbuf[16] = 0;
1922 len += scnprintf(buf + len, PAGE_SIZE - len, "VendorSN:\t%s\n", chbuf);
1923 strncpy(chbuf, &rdp_context->page_a0[SSF_VENDOR_REV], 4);
1924 chbuf[4] = 0;
1925 len += scnprintf(buf + len, PAGE_SIZE - len, "VendorRev:\t%s\n", chbuf);
1926 strncpy(chbuf, &rdp_context->page_a0[SSF_DATE_CODE], 8);
1927 chbuf[8] = 0;
1928 len += scnprintf(buf + len, PAGE_SIZE - len, "DateCode:\t%s\n", chbuf);
1929 len += scnprintf(buf + len, PAGE_SIZE - len, "Identifier:\t%xh\n",
1930 (uint8_t)rdp_context->page_a0[SSF_IDENTIFIER]);
1931 len += scnprintf(buf + len, PAGE_SIZE - len, "ExtIdentifier:\t%xh\n",
1932 (uint8_t)rdp_context->page_a0[SSF_EXT_IDENTIFIER]);
1933 len += scnprintf(buf + len, PAGE_SIZE - len, "Connector:\t%xh\n",
1934 (uint8_t)rdp_context->page_a0[SSF_CONNECTOR]);
1935 wavelength = (rdp_context->page_a0[SSF_WAVELENGTH_B1] << 8) |
1936 rdp_context->page_a0[SSF_WAVELENGTH_B0];
1937
1938 len += scnprintf(buf + len, PAGE_SIZE - len, "Wavelength:\t%d nm\n",
1939 wavelength);
1940 trasn_code_byte7 = (struct sff_trasnceiver_codes_byte7 *)
1941 &rdp_context->page_a0[SSF_TRANSCEIVER_CODE_B7];
1942
1943 len += scnprintf(buf + len, PAGE_SIZE - len, "Speeds: \t");
> 1944 if (*(uint8_t *)trasn_code_byte7 == 0) {
1945 len += scnprintf(buf + len, PAGE_SIZE - len,
1946 "Unknown\n");
1947 } else {
1948 if (trasn_code_byte7->fc_sp_100MB)
1949 len += scnprintf(buf + len, PAGE_SIZE - len,
1950 "1 ");
1951 if (trasn_code_byte7->fc_sp_200mb)
1952 len += scnprintf(buf + len, PAGE_SIZE - len,
1953 "2 ");
1954 if (trasn_code_byte7->fc_sp_400MB)
1955 len += scnprintf(buf + len, PAGE_SIZE - len,
1956 "4 ");
1957 if (trasn_code_byte7->fc_sp_800MB)
1958 len += scnprintf(buf + len, PAGE_SIZE - len,
1959 "8 ");
1960 if (trasn_code_byte7->fc_sp_1600MB)
1961 len += scnprintf(buf + len, PAGE_SIZE - len,
1962 "16 ");
1963 if (trasn_code_byte7->fc_sp_3200MB)
1964 len += scnprintf(buf + len, PAGE_SIZE - len,
1965 "32 ");
1966 if (trasn_code_byte7->speed_chk_ecc)
1967 len += scnprintf(buf + len, PAGE_SIZE - len,
1968 "64 ");
1969 len += scnprintf(buf + len, PAGE_SIZE - len, "GB\n");
1970 }
1971 temperature = (rdp_context->page_a2[SFF_TEMPERATURE_B1] << 8 |
1972 rdp_context->page_a2[SFF_TEMPERATURE_B0]);
1973 vcc = (rdp_context->page_a2[SFF_VCC_B1] << 8 |
1974 rdp_context->page_a2[SFF_VCC_B0]);
1975 tx_power = (rdp_context->page_a2[SFF_TXPOWER_B1] << 8 |
1976 rdp_context->page_a2[SFF_TXPOWER_B0]);
1977 tx_bias = (rdp_context->page_a2[SFF_TX_BIAS_CURRENT_B1] << 8 |
1978 rdp_context->page_a2[SFF_TX_BIAS_CURRENT_B0]);
1979 rx_power = (rdp_context->page_a2[SFF_RXPOWER_B1] << 8 |
1980 rdp_context->page_a2[SFF_RXPOWER_B0]);
1981
1982 len += scnprintf(buf + len, PAGE_SIZE - len,
1983 "Temperature:\tx%04x C\n", temperature);
1984 len += scnprintf(buf + len, PAGE_SIZE - len, "Vcc:\t\tx%04x V\n", vcc);
1985 len += scnprintf(buf + len, PAGE_SIZE - len,
1986 "TxBiasCurrent:\tx%04x mA\n", tx_bias);
1987 len += scnprintf(buf + len, PAGE_SIZE - len, "TxPower:\tx%04x mW\n",
1988 tx_power);
1989 len += scnprintf(buf + len, PAGE_SIZE - len, "RxPower:\tx%04x mW\n",
1990 rx_power);
1991 out_free_rdp:
1992 kfree(rdp_context);
1993 return len;
1994 }
1995
--
0-DAY CI Kernel Test Service
https://01.org/lkp
View attachment "config" of type "text/plain" (183086 bytes)
Powered by blists - more mailing lists