diff mbox series

[SCSI] BusLogic: add printf attribute to log function

Message ID 20201221162212.3755805-1-trix@redhat.com (mailing list archive)
State Changes Requested
Headers show
Series [SCSI] BusLogic: add printf attribute to log function | expand

Commit Message

Tom Rix Dec. 21, 2020, 4:22 p.m. UTC
From: Tom Rix <trix@redhat.com>

Attributing the function allows the compiler to more thoroughly
check the use of the function with -Wformat and similar flags.

Signed-off-by: Tom Rix <trix@redhat.com>
---
 drivers/scsi/BusLogic.h | 1 +
 1 file changed, 1 insertion(+)

Comments

kernel test robot Dec. 27, 2020, 12:38 a.m. UTC | #1
Hi,

I love your patch! Perhaps something to improve:

[auto build test WARNING on mkp-scsi/for-next]
[also build test WARNING on scsi/for-next linux/master linus/master v5.10 next-20201223]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/trix-redhat-com/BusLogic-add-printf-attribute-to-log-function/20201222-002810
base:   https://git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git for-next
config: x86_64-randconfig-a012-20201221 (attached as .config)
compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project cee1e7d14f4628d6174b33640d502bff3b54ae45)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # install x86_64 cross compiling tool for clang build
        # apt-get install binutils-x86-64-linux-gnu
        # https://github.com/0day-ci/linux/commit/075b48dfc24070e441424a02564f8934db1d039b
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review trix-redhat-com/BusLogic-add-printf-attribute-to-log-function/20201222-002810
        git checkout 075b48dfc24070e441424a02564f8934db1d039b
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

>> drivers/scsi/BusLogic.c:1849:6: warning: format specifies type 'unsigned long' but the argument has type 'u32' (aka 'unsigned int') [-Wformat]
                                           adapter->bios_addr);
                                           ^~~~~~~~~~~~~~~~~~
   drivers/scsi/BusLogic.h:125:42: note: expanded from macro 'blogic_info'
           blogic_msg(BLOGIC_INFO_LEVEL, format, ##args)
                                         ~~~~~~    ^~~~
   1 warning generated.


vim +1849 drivers/scsi/BusLogic.c

^1da177e4c3f415 Linus Torvalds 2005-04-16  1821  
839cb99e8f74839 Khalid Aziz    2013-05-16  1822  static bool __init blogic_reportconfig(struct blogic_adapter *adapter)
^1da177e4c3f415 Linus Torvalds 2005-04-16  1823  {
839cb99e8f74839 Khalid Aziz    2013-05-16  1824  	unsigned short alltgt_mask = (1 << adapter->maxdev) - 1;
839cb99e8f74839 Khalid Aziz    2013-05-16  1825  	unsigned short sync_ok, fast_ok;
839cb99e8f74839 Khalid Aziz    2013-05-16  1826  	unsigned short ultra_ok, wide_ok;
839cb99e8f74839 Khalid Aziz    2013-05-16  1827  	unsigned short discon_ok, tagq_ok;
839cb99e8f74839 Khalid Aziz    2013-05-16  1828  	bool common_syncneg, common_tagq_depth;
839cb99e8f74839 Khalid Aziz    2013-05-16  1829  	char syncstr[BLOGIC_MAXDEV + 1];
839cb99e8f74839 Khalid Aziz    2013-05-16  1830  	char widestr[BLOGIC_MAXDEV + 1];
839cb99e8f74839 Khalid Aziz    2013-05-16  1831  	char discon_str[BLOGIC_MAXDEV + 1];
839cb99e8f74839 Khalid Aziz    2013-05-16  1832  	char tagq_str[BLOGIC_MAXDEV + 1];
839cb99e8f74839 Khalid Aziz    2013-05-16  1833  	char *syncmsg = syncstr;
839cb99e8f74839 Khalid Aziz    2013-05-16  1834  	char *widemsg = widestr;
839cb99e8f74839 Khalid Aziz    2013-05-16  1835  	char *discon_msg = discon_str;
839cb99e8f74839 Khalid Aziz    2013-05-16  1836  	char *tagq_msg = tagq_str;
839cb99e8f74839 Khalid Aziz    2013-05-16  1837  	int tgt_id;
839cb99e8f74839 Khalid Aziz    2013-05-16  1838  
839cb99e8f74839 Khalid Aziz    2013-05-16  1839  	blogic_info("Configuring BusLogic Model %s %s%s%s%s SCSI Host Adapter\n", adapter, adapter->model, blogic_adapter_busnames[adapter->adapter_bus_type], (adapter->wide ? " Wide" : ""), (adapter->differential ? " Differential" : ""), (adapter->ultra ? " Ultra" : ""));
43622697117c393 Colin Ian King 2020-01-08  1840  	blogic_info("  Firmware Version: %s, I/O Address: 0x%lX, IRQ Channel: %d/%s\n", adapter, adapter->fw_ver, adapter->io_addr, adapter->irq_ch, (adapter->level_int ? "Level" : "Edge"));
839cb99e8f74839 Khalid Aziz    2013-05-16  1841  	if (adapter->adapter_bus_type != BLOGIC_PCI_BUS) {
839cb99e8f74839 Khalid Aziz    2013-05-16  1842  		blogic_info("  DMA Channel: ", adapter);
839cb99e8f74839 Khalid Aziz    2013-05-16  1843  		if (adapter->dma_ch > 0)
839cb99e8f74839 Khalid Aziz    2013-05-16  1844  			blogic_info("%d, ", adapter, adapter->dma_ch);
^1da177e4c3f415 Linus Torvalds 2005-04-16  1845  		else
839cb99e8f74839 Khalid Aziz    2013-05-16  1846  			blogic_info("None, ", adapter);
839cb99e8f74839 Khalid Aziz    2013-05-16  1847  		if (adapter->bios_addr > 0)
43622697117c393 Colin Ian King 2020-01-08  1848  			blogic_info("BIOS Address: 0x%lX, ", adapter,
839cb99e8f74839 Khalid Aziz    2013-05-16 @1849  					adapter->bios_addr);
^1da177e4c3f415 Linus Torvalds 2005-04-16  1850  		else
839cb99e8f74839 Khalid Aziz    2013-05-16  1851  			blogic_info("BIOS Address: None, ", adapter);
^1da177e4c3f415 Linus Torvalds 2005-04-16  1852  	} else {
839cb99e8f74839 Khalid Aziz    2013-05-16  1853  		blogic_info("  PCI Bus: %d, Device: %d, Address: ", adapter,
839cb99e8f74839 Khalid Aziz    2013-05-16  1854  				adapter->bus, adapter->dev);
839cb99e8f74839 Khalid Aziz    2013-05-16  1855  		if (adapter->pci_addr > 0)
43622697117c393 Colin Ian King 2020-01-08  1856  			blogic_info("0x%lX, ", adapter, adapter->pci_addr);
^1da177e4c3f415 Linus Torvalds 2005-04-16  1857  		else
839cb99e8f74839 Khalid Aziz    2013-05-16  1858  			blogic_info("Unassigned, ", adapter);
839cb99e8f74839 Khalid Aziz    2013-05-16  1859  	}
839cb99e8f74839 Khalid Aziz    2013-05-16  1860  	blogic_info("Host Adapter SCSI ID: %d\n", adapter, adapter->scsi_id);
839cb99e8f74839 Khalid Aziz    2013-05-16  1861  	blogic_info("  Parity Checking: %s, Extended Translation: %s\n",
839cb99e8f74839 Khalid Aziz    2013-05-16  1862  			adapter, (adapter->parity ? "Enabled" : "Disabled"),
839cb99e8f74839 Khalid Aziz    2013-05-16  1863  			(adapter->ext_trans_enable ? "Enabled" : "Disabled"));
839cb99e8f74839 Khalid Aziz    2013-05-16  1864  	alltgt_mask &= ~(1 << adapter->scsi_id);
839cb99e8f74839 Khalid Aziz    2013-05-16  1865  	sync_ok = adapter->sync_ok & alltgt_mask;
839cb99e8f74839 Khalid Aziz    2013-05-16  1866  	fast_ok = adapter->fast_ok & alltgt_mask;
839cb99e8f74839 Khalid Aziz    2013-05-16  1867  	ultra_ok = adapter->ultra_ok & alltgt_mask;
839cb99e8f74839 Khalid Aziz    2013-05-16  1868  	if ((blogic_multimaster_type(adapter) &&
839cb99e8f74839 Khalid Aziz    2013-05-16  1869  			(adapter->fw_ver[0] >= '4' ||
839cb99e8f74839 Khalid Aziz    2013-05-16  1870  			 adapter->adapter_bus_type == BLOGIC_EISA_BUS)) ||
839cb99e8f74839 Khalid Aziz    2013-05-16  1871  			blogic_flashpoint_type(adapter)) {
839cb99e8f74839 Khalid Aziz    2013-05-16  1872  		common_syncneg = false;
839cb99e8f74839 Khalid Aziz    2013-05-16  1873  		if (sync_ok == 0) {
839cb99e8f74839 Khalid Aziz    2013-05-16  1874  			syncmsg = "Disabled";
839cb99e8f74839 Khalid Aziz    2013-05-16  1875  			common_syncneg = true;
839cb99e8f74839 Khalid Aziz    2013-05-16  1876  		} else if (sync_ok == alltgt_mask) {
839cb99e8f74839 Khalid Aziz    2013-05-16  1877  			if (fast_ok == 0) {
839cb99e8f74839 Khalid Aziz    2013-05-16  1878  				syncmsg = "Slow";
839cb99e8f74839 Khalid Aziz    2013-05-16  1879  				common_syncneg = true;
839cb99e8f74839 Khalid Aziz    2013-05-16  1880  			} else if (fast_ok == alltgt_mask) {
839cb99e8f74839 Khalid Aziz    2013-05-16  1881  				if (ultra_ok == 0) {
839cb99e8f74839 Khalid Aziz    2013-05-16  1882  					syncmsg = "Fast";
839cb99e8f74839 Khalid Aziz    2013-05-16  1883  					common_syncneg = true;
839cb99e8f74839 Khalid Aziz    2013-05-16  1884  				} else if (ultra_ok == alltgt_mask) {
839cb99e8f74839 Khalid Aziz    2013-05-16  1885  					syncmsg = "Ultra";
839cb99e8f74839 Khalid Aziz    2013-05-16  1886  					common_syncneg = true;
839cb99e8f74839 Khalid Aziz    2013-05-16  1887  				}
839cb99e8f74839 Khalid Aziz    2013-05-16  1888  			}
839cb99e8f74839 Khalid Aziz    2013-05-16  1889  		}
839cb99e8f74839 Khalid Aziz    2013-05-16  1890  		if (!common_syncneg) {
839cb99e8f74839 Khalid Aziz    2013-05-16  1891  			for (tgt_id = 0; tgt_id < adapter->maxdev; tgt_id++)
839cb99e8f74839 Khalid Aziz    2013-05-16  1892  				syncstr[tgt_id] = ((!(sync_ok & (1 << tgt_id))) ? 'N' : (!(fast_ok & (1 << tgt_id)) ? 'S' : (!(ultra_ok & (1 << tgt_id)) ? 'F' : 'U')));
839cb99e8f74839 Khalid Aziz    2013-05-16  1893  			syncstr[adapter->scsi_id] = '#';
839cb99e8f74839 Khalid Aziz    2013-05-16  1894  			syncstr[adapter->maxdev] = '\0';
^1da177e4c3f415 Linus Torvalds 2005-04-16  1895  		}
^1da177e4c3f415 Linus Torvalds 2005-04-16  1896  	} else
839cb99e8f74839 Khalid Aziz    2013-05-16  1897  		syncmsg = (sync_ok == 0 ? "Disabled" : "Enabled");
839cb99e8f74839 Khalid Aziz    2013-05-16  1898  	wide_ok = adapter->wide_ok & alltgt_mask;
839cb99e8f74839 Khalid Aziz    2013-05-16  1899  	if (wide_ok == 0)
839cb99e8f74839 Khalid Aziz    2013-05-16  1900  		widemsg = "Disabled";
839cb99e8f74839 Khalid Aziz    2013-05-16  1901  	else if (wide_ok == alltgt_mask)
839cb99e8f74839 Khalid Aziz    2013-05-16  1902  		widemsg = "Enabled";
^1da177e4c3f415 Linus Torvalds 2005-04-16  1903  	else {
839cb99e8f74839 Khalid Aziz    2013-05-16  1904  		for (tgt_id = 0; tgt_id < adapter->maxdev; tgt_id++)
839cb99e8f74839 Khalid Aziz    2013-05-16  1905  			widestr[tgt_id] = ((wide_ok & (1 << tgt_id)) ? 'Y' : 'N');
839cb99e8f74839 Khalid Aziz    2013-05-16  1906  		widestr[adapter->scsi_id] = '#';
839cb99e8f74839 Khalid Aziz    2013-05-16  1907  		widestr[adapter->maxdev] = '\0';
839cb99e8f74839 Khalid Aziz    2013-05-16  1908  	}
839cb99e8f74839 Khalid Aziz    2013-05-16  1909  	discon_ok = adapter->discon_ok & alltgt_mask;
839cb99e8f74839 Khalid Aziz    2013-05-16  1910  	if (discon_ok == 0)
839cb99e8f74839 Khalid Aziz    2013-05-16  1911  		discon_msg = "Disabled";
839cb99e8f74839 Khalid Aziz    2013-05-16  1912  	else if (discon_ok == alltgt_mask)
839cb99e8f74839 Khalid Aziz    2013-05-16  1913  		discon_msg = "Enabled";
^1da177e4c3f415 Linus Torvalds 2005-04-16  1914  	else {
839cb99e8f74839 Khalid Aziz    2013-05-16  1915  		for (tgt_id = 0; tgt_id < adapter->maxdev; tgt_id++)
839cb99e8f74839 Khalid Aziz    2013-05-16  1916  			discon_str[tgt_id] = ((discon_ok & (1 << tgt_id)) ? 'Y' : 'N');
839cb99e8f74839 Khalid Aziz    2013-05-16  1917  		discon_str[adapter->scsi_id] = '#';
839cb99e8f74839 Khalid Aziz    2013-05-16  1918  		discon_str[adapter->maxdev] = '\0';
839cb99e8f74839 Khalid Aziz    2013-05-16  1919  	}
839cb99e8f74839 Khalid Aziz    2013-05-16  1920  	tagq_ok = adapter->tagq_ok & alltgt_mask;
839cb99e8f74839 Khalid Aziz    2013-05-16  1921  	if (tagq_ok == 0)
839cb99e8f74839 Khalid Aziz    2013-05-16  1922  		tagq_msg = "Disabled";
839cb99e8f74839 Khalid Aziz    2013-05-16  1923  	else if (tagq_ok == alltgt_mask)
839cb99e8f74839 Khalid Aziz    2013-05-16  1924  		tagq_msg = "Enabled";
^1da177e4c3f415 Linus Torvalds 2005-04-16  1925  	else {
839cb99e8f74839 Khalid Aziz    2013-05-16  1926  		for (tgt_id = 0; tgt_id < adapter->maxdev; tgt_id++)
839cb99e8f74839 Khalid Aziz    2013-05-16  1927  			tagq_str[tgt_id] = ((tagq_ok & (1 << tgt_id)) ? 'Y' : 'N');
839cb99e8f74839 Khalid Aziz    2013-05-16  1928  		tagq_str[adapter->scsi_id] = '#';
839cb99e8f74839 Khalid Aziz    2013-05-16  1929  		tagq_str[adapter->maxdev] = '\0';
839cb99e8f74839 Khalid Aziz    2013-05-16  1930  	}
839cb99e8f74839 Khalid Aziz    2013-05-16  1931  	blogic_info("  Synchronous Negotiation: %s, Wide Negotiation: %s\n",
839cb99e8f74839 Khalid Aziz    2013-05-16  1932  			adapter, syncmsg, widemsg);
839cb99e8f74839 Khalid Aziz    2013-05-16  1933  	blogic_info("  Disconnect/Reconnect: %s, Tagged Queuing: %s\n", adapter,
839cb99e8f74839 Khalid Aziz    2013-05-16  1934  			discon_msg, tagq_msg);
839cb99e8f74839 Khalid Aziz    2013-05-16  1935  	if (blogic_multimaster_type(adapter)) {
43622697117c393 Colin Ian King 2020-01-08  1936  		blogic_info("  Scatter/Gather Limit: %d of %d segments, Mailboxes: %d\n", adapter, adapter->drvr_sglimit, adapter->adapter_sglimit, adapter->mbox_count);
43622697117c393 Colin Ian King 2020-01-08  1937  		blogic_info("  Driver Queue Depth: %d, Host Adapter Queue Depth: %d\n", adapter, adapter->drvr_qdepth, adapter->adapter_qdepth);
^1da177e4c3f415 Linus Torvalds 2005-04-16  1938  	} else
43622697117c393 Colin Ian King 2020-01-08  1939  		blogic_info("  Driver Queue Depth: %d, Scatter/Gather Limit: %d segments\n", adapter, adapter->drvr_qdepth, adapter->drvr_sglimit);
839cb99e8f74839 Khalid Aziz    2013-05-16  1940  	blogic_info("  Tagged Queue Depth: ", adapter);
839cb99e8f74839 Khalid Aziz    2013-05-16  1941  	common_tagq_depth = true;
839cb99e8f74839 Khalid Aziz    2013-05-16  1942  	for (tgt_id = 1; tgt_id < adapter->maxdev; tgt_id++)
839cb99e8f74839 Khalid Aziz    2013-05-16  1943  		if (adapter->qdepth[tgt_id] != adapter->qdepth[0]) {
839cb99e8f74839 Khalid Aziz    2013-05-16  1944  			common_tagq_depth = false;
^1da177e4c3f415 Linus Torvalds 2005-04-16  1945  			break;
^1da177e4c3f415 Linus Torvalds 2005-04-16  1946  		}
839cb99e8f74839 Khalid Aziz    2013-05-16  1947  	if (common_tagq_depth) {
839cb99e8f74839 Khalid Aziz    2013-05-16  1948  		if (adapter->qdepth[0] > 0)
839cb99e8f74839 Khalid Aziz    2013-05-16  1949  			blogic_info("%d", adapter, adapter->qdepth[0]);
^1da177e4c3f415 Linus Torvalds 2005-04-16  1950  		else
839cb99e8f74839 Khalid Aziz    2013-05-16  1951  			blogic_info("Automatic", adapter);
^1da177e4c3f415 Linus Torvalds 2005-04-16  1952  	} else
839cb99e8f74839 Khalid Aziz    2013-05-16  1953  		blogic_info("Individual", adapter);
839cb99e8f74839 Khalid Aziz    2013-05-16  1954  	blogic_info(", Untagged Queue Depth: %d\n", adapter,
839cb99e8f74839 Khalid Aziz    2013-05-16  1955  			adapter->untag_qdepth);
839cb99e8f74839 Khalid Aziz    2013-05-16  1956  	if (adapter->terminfo_valid) {
839cb99e8f74839 Khalid Aziz    2013-05-16  1957  		if (adapter->wide)
839cb99e8f74839 Khalid Aziz    2013-05-16  1958  			blogic_info("  SCSI Bus Termination: %s", adapter,
839cb99e8f74839 Khalid Aziz    2013-05-16  1959  				(adapter->low_term ? (adapter->high_term ? "Both Enabled" : "Low Enabled") : (adapter->high_term ? "High Enabled" : "Both Disabled")));
^1da177e4c3f415 Linus Torvalds 2005-04-16  1960  		else
839cb99e8f74839 Khalid Aziz    2013-05-16  1961  			blogic_info("  SCSI Bus Termination: %s", adapter,
839cb99e8f74839 Khalid Aziz    2013-05-16  1962  				(adapter->low_term ? "Enabled" : "Disabled"));
839cb99e8f74839 Khalid Aziz    2013-05-16  1963  		if (adapter->scam)
839cb99e8f74839 Khalid Aziz    2013-05-16  1964  			blogic_info(", SCAM: %s", adapter,
839cb99e8f74839 Khalid Aziz    2013-05-16  1965  				(adapter->scam_enabled ? (adapter->scam_lev2 ? "Enabled, Level 2" : "Enabled, Level 1") : "Disabled"));
839cb99e8f74839 Khalid Aziz    2013-05-16  1966  		blogic_info("\n", adapter);
^1da177e4c3f415 Linus Torvalds 2005-04-16  1967  	}
^1da177e4c3f415 Linus Torvalds 2005-04-16  1968  	/*
839cb99e8f74839 Khalid Aziz    2013-05-16  1969  	   Indicate reporting the Host Adapter configuration completed
839cb99e8f74839 Khalid Aziz    2013-05-16  1970  	   successfully.
^1da177e4c3f415 Linus Torvalds 2005-04-16  1971  	 */
^1da177e4c3f415 Linus Torvalds 2005-04-16  1972  	return true;
^1da177e4c3f415 Linus Torvalds 2005-04-16  1973  }
^1da177e4c3f415 Linus Torvalds 2005-04-16  1974  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
diff mbox series

Patch

diff --git a/drivers/scsi/BusLogic.h b/drivers/scsi/BusLogic.h
index 6182cc8a0344..b701fc8ba789 100644
--- a/drivers/scsi/BusLogic.h
+++ b/drivers/scsi/BusLogic.h
@@ -1289,6 +1289,7 @@  static int blogic_slaveconfig(struct scsi_device *);
 static void blogic_qcompleted_ccb(struct blogic_ccb *);
 static irqreturn_t blogic_inthandler(int, void *);
 static int blogic_resetadapter(struct blogic_adapter *, bool hard_reset);
+__printf(2, 4)
 static void blogic_msg(enum blogic_msglevel, char *, struct blogic_adapter *, ...);
 static int __init blogic_setup(char *);