Skip to contentSkip to conversation

mtd: cfi_cmdset_0001: Factor out do_write_buffer_locked() to reduce stack frame

PATCH Superseded Andy Shevchenko 3 participants 4 messages Jan 24 – Feb 10 Memory technology devices (MTD)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 mtd: cfi_cmdset_0001: Factor out do_write_buffer_locked() to reduce stack frame

Compiler is not happy about used stack frame:

drivers/mtd/chips/cfi_cmdset_0001.c: In function 'do_write_buffer':
drivers/mtd/chips/cfi_cmdset_0001.c:1887:1: error: the frame size of 1296 bytes is larger than 1280 bytes [-Werror=frame-larger-than=]

Fix this by factoring out do_write_buffer_locked().

---
v2: left ENABLE_VPP() and XIP_INVAL_CACHED_RANGE() where they were originally

 drivers/mtd/chips/cfi_cmdset_0001.c | 82 +++++++++++++++++------------
 1 file changed, 48 insertions(+), 34 deletions(-)
drivers/mtd/chips/cfi_cmdset_0001.c +48 -34
index c10693ba265b..c495bee04053 100644
@@ -1720,42 +1720,24 @@ static int cfi_intelext_write_words (struct mtd_info *mtd, loff_t to , size_t le
 }
 
 
-static int __xipram do_write_buffer(struct map_info *map, struct flchip *chip,
-				    unsigned long adr, const struct kvec **pvec,
-				    unsigned long *pvec_seek, int len)
+static int __xipram do_write_buffer_locked(struct map_info *map, struct flchip *chip,
+					   unsigned long cmd_adr, unsigned long adr,
+					   const struct kvec **pvec,
+					   unsigned long *pvec_seek, int len)
 {
 	struct cfi_private *cfi = map->fldrv_priv;
 	map_word status, write_cmd, datum;
-	unsigned long cmd_adr;
-	int ret, wbufsize, word_gap, words;
+	int ret, word_gap, words;
 	const struct kvec *vec;
 	unsigned long vec_seek;
 	unsigned long initial_adr;
 	int initial_len = len;
 
-	wbufsize = cfi_interleave(cfi) << cfi->cfiq->MaxBufWriteSize;
-	adr += chip->start;
 	initial_adr = adr;
-	cmd_adr = adr & ~(wbufsize-1);
-
-	/* Sharp LH28F640BF chips need the first address for the
-	 * Page Buffer Program command. See Table 5 of
-	 * LH28F320BF, LH28F640BF, LH28F128BF Series (Appendix FUM00701) */
-	if (is_LH28F640BF(cfi))
-		cmd_adr = adr;
 
 	/* Let's determine this according to the interleave only once */
 	write_cmd = (cfi->cfiq->P_ID != P_ID_INTEL_PERFORMANCE) ? CMD(0xe8) : CMD(0xe9);
 
-	mutex_lock(&chip->mutex);
-	ret = get_chip(map, chip, cmd_adr, FL_WRITING);
-	if (ret) {
-		mutex_unlock(&chip->mutex);
-		return ret;
-	}
-
-	XIP_INVAL_CACHED_RANGE(map, initial_adr, initial_len);
-	ENABLE_VPP(map);
 	xip_disable(map, chip, cmd_adr);
 
 	/* §4.8 of the 28FxxxJ3A datasheet says "Any time SR.4 and/or SR.5 is set
@@ -1789,7 +1771,7 @@ static int __xipram do_write_buffer(struct map_info *map, struct flchip *chip,
 		xip_enable(map, chip, cmd_adr);
 		printk(KERN_ERR "%s: Chip not ready for buffer write. Xstatus = %lx, status = %lx\n",
 				map->name, Xstatus.x[0], status.x[0]);
-		goto out;
+		return ret;
 	}
 
 	/* Figure out the number of words to write */
@@ -1853,7 +1835,7 @@ static int __xipram do_write_buffer(struct map_info *map, struct flchip *chip,
 		chip->state = FL_STATUS;
 		xip_enable(map, chip, cmd_adr);
 		printk(KERN_ERR "%s: buffer write error (status timeout)\n", map->name);
-		goto out;
+		return ret;
 	}
 
 	/* check for errors */
@@ -1866,21 +1848,53 @@ static int __xipram do_write_buffer(struct map_info *map, struct flchip *chip,
 		map_write(map, CMD(0x70), cmd_adr);
 		xip_enable(map, chip, cmd_adr);
 
-		if (chipstatus & 0x02) {
-			ret = -EROFS;
-		} else if (chipstatus & 0x08) {
+		if (chipstatus & 0x02)
+			return -EROFS;
+
+		if (chipstatus & 0x08) {
 			printk(KERN_ERR "%s: buffer write error (bad VPP)\n", map->name);
-			ret = -EIO;
-		} else {
-			printk(KERN_ERR "%s: buffer write error (status 0x%lx)\n", map->name, chipstatus);
-			ret = -EINVAL;
+			return  -EIO;
 		}
 
-		goto out;
+		printk(KERN_ERR "%s: buffer write error (status 0x%lx)\n", map->name, chipstatus);
+		return -EINVAL;
 	}
 
 	xip_enable(map, chip, cmd_adr);
- out:	DISABLE_VPP(map);
+	return 0;
+}
+
+static int __xipram do_write_buffer(struct map_info *map, struct flchip *chip,
+				    unsigned long adr, const struct kvec **pvec,
+				    unsigned long *pvec_seek, int len)
+{
+	struct cfi_private *cfi = map->fldrv_priv;
+	unsigned long cmd_adr;
+	int ret, wbufsize;
+
+	wbufsize = cfi_interleave(cfi) << cfi->cfiq->MaxBufWriteSize;
+	adr += chip->start;
+	cmd_adr = adr & ~(wbufsize - 1);
+
+	/* Sharp LH28F640BF chips need the first address for the
+	 * Page Buffer Program command. See Table 5 of
+	 * LH28F320BF, LH28F640BF, LH28F128BF Series (Appendix FUM00701) */
+	if (is_LH28F640BF(cfi))
+		cmd_adr = adr;
+
+	mutex_lock(&chip->mutex);
+	ret = get_chip(map, chip, cmd_adr, FL_WRITING);
+	if (ret) {
+		mutex_unlock(&chip->mutex);
+		return ret;
+	}
+
+	XIP_INVAL_CACHED_RANGE(map, adr, len);
+	ENABLE_VPP(map);
+
+	ret = do_write_buffer_locked(map, chip, cmd_adr, adr, pvec, pvec_seek, len);
+
+	DISABLE_VPP(map);
 	put_chip(map, chip, cmd_adr);
 	mutex_unlock(&chip->mutex);
 	return ret;
Signature · 1 line
2.50.1
#1 lore raw
kernel test robot noticed the following build warnings:

Hi Andy,

kernel test robot noticed the following build warnings:

[auto build test WARNING on mtd/mtd/next]
[also build test WARNING on mtd/mtd/fixes linus/master v6.19-rc6 next-20260123] [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#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Andy-Shevchenko/mtd-cfi_cmdset_0001-Factor-out-do_write_buffer_locked-to-reduce-stack-frame/20260124-213936
base:   https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git mtd/next
patch link:    https://lore.kernel.org/r/20260124133730.3454241-1-andriy.shevchenko%40linux.intel.com
patch subject: [PATCH v2 1/1] mtd: cfi_cmdset_0001: Factor out do_write_buffer_locked() to reduce stack frame
config: xtensa-randconfig-002-20260125 (https://download.01.org/0day-ci/archive/20260125/[email protected]/config)
compiler: xtensa-linux-gcc (GCC) 8.5.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260125/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All warnings (new ones prefixed by >>):

drivers/mtd/chips/cfi_cmdset_0001.c: In function 'do_write_buffer_locked':

>> drivers/mtd/chips/cfi_cmdset_0001.c:1734:6: warning: unused variable 'initial_len' [-Wunused-variable]
     int initial_len = len;
         ^~~~~~~~~~~
>> drivers/mtd/chips/cfi_cmdset_0001.c:1733:16: warning: variable 'initial_adr' set but not used [-Wunused-but-set-variable]
     unsigned long initial_adr;
                   ^~~~~~~~~~~

vim +/initial_len +1734 drivers/mtd/chips/cfi_cmdset_0001.c

^1da177e4c3f415 Linus Torvalds   2005-04-16  1721  
^1da177e4c3f415 Linus Torvalds   2005-04-16  1722  
b8a0764c058e872 Andy Shevchenko  2026-01-24  1723  static int __xipram do_write_buffer_locked(struct map_info *map, struct flchip *chip,
b8a0764c058e872 Andy Shevchenko  2026-01-24  1724  					   unsigned long cmd_adr, unsigned long adr,
b8a0764c058e872 Andy Shevchenko  2026-01-24  1725  					   const struct kvec **pvec,
e102d54abf6806b Nicolas Pitre    2005-08-06  1726  					   unsigned long *pvec_seek, int len)
^1da177e4c3f415 Linus Torvalds   2005-04-16  1727  {
^1da177e4c3f415 Linus Torvalds   2005-04-16  1728  	struct cfi_private *cfi = map->fldrv_priv;
c172471b78255a5 Nicolas Pitre    2006-03-30  1729  	map_word status, write_cmd, datum;
b8a0764c058e872 Andy Shevchenko  2026-01-24  1730  	int ret, word_gap, words;
e102d54abf6806b Nicolas Pitre    2005-08-06  1731  	const struct kvec *vec;
e102d54abf6806b Nicolas Pitre    2005-08-06  1732  	unsigned long vec_seek;
646fd12784d5061 Massimo Cirillo  2008-01-11 @1733  	unsigned long initial_adr;
646fd12784d5061 Massimo Cirillo  2008-01-11 @1734  	int initial_len = len;
^1da177e4c3f415 Linus Torvalds   2005-04-16  1735  
646fd12784d5061 Massimo Cirillo  2008-01-11  1736  	initial_adr = adr;
812c5fa82bae9f3 Andrea Adami     2014-06-02  1737  
^1da177e4c3f415 Linus Torvalds   2005-04-16  1738  	/* Let's determine this according to the interleave only once */
b5d194ceaeffce6 Guillaume LECERF 2010-10-26  1739  	write_cmd = (cfi->cfiq->P_ID != P_ID_INTEL_PERFORMANCE) ? CMD(0xe8) : CMD(0xe9);
^1da177e4c3f415 Linus Torvalds   2005-04-16  1740  
^1da177e4c3f415 Linus Torvalds   2005-04-16  1741  	xip_disable(map, chip, cmd_adr);
^1da177e4c3f415 Linus Torvalds   2005-04-16  1742  
151e76590f66f54 David Woodhouse  2006-05-14  1743  	/* §4.8 of the 28FxxxJ3A datasheet says "Any time SR.4 and/or SR.5 is set
^1da177e4c3f415 Linus Torvalds   2005-04-16  1744  	   [...], the device will not accept any more Write to Buffer commands".
^1da177e4c3f415 Linus Torvalds   2005-04-16  1745  	   So we must check here and reset those bits if they're set. Otherwise
^1da177e4c3f415 Linus Torvalds   2005-04-16  1746  	   we're just pissing in the wind */
6e7a6809c555aeb Nicolas Pitre    2006-03-29  1747  	if (chip->state != FL_STATUS) {
^1da177e4c3f415 Linus Torvalds   2005-04-16  1748  		map_write(map, CMD(0x70), cmd_adr);
6e7a6809c555aeb Nicolas Pitre    2006-03-29  1749  		chip->state = FL_STATUS;
6e7a6809c555aeb Nicolas Pitre    2006-03-29  1750  	}
^1da177e4c3f415 Linus Torvalds   2005-04-16  1751  	status = map_read(map, cmd_adr);
^1da177e4c3f415 Linus Torvalds   2005-04-16  1752  	if (map_word_bitsset(map, status, CMD(0x30))) {
^1da177e4c3f415 Linus Torvalds   2005-04-16  1753  		xip_enable(map, chip, cmd_adr);
^1da177e4c3f415 Linus Torvalds   2005-04-16  1754  		printk(KERN_WARNING "SR.4 or SR.5 bits set in buffer write (status %lx). Clearing.\n", status.x[0]);
^1da177e4c3f415 Linus Torvalds   2005-04-16  1755  		xip_disable(map, chip, cmd_adr);
^1da177e4c3f415 Linus Torvalds   2005-04-16  1756  		map_write(map, CMD(0x50), cmd_adr);
^1da177e4c3f415 Linus Torvalds   2005-04-16  1757  		map_write(map, CMD(0x70), cmd_adr);
^1da177e4c3f415 Linus Torvalds   2005-04-16  1758  	}
^1da177e4c3f415 Linus Torvalds   2005-04-16  1759  
^1da177e4c3f415 Linus Torvalds   2005-04-16  1760  	chip->state = FL_WRITING_TO_BUFFER;
638d983840bb64e Nicolas Pitre    2005-08-06  1761  	map_write(map, write_cmd, cmd_adr);
e93cafe45fd7493 Anders Grafström 2008-08-05  1762  	ret = WAIT_TIMEOUT(map, chip, cmd_adr, 0, 0);
c172471b78255a5 Nicolas Pitre    2006-03-30  1763  	if (ret) {
^1da177e4c3f415 Linus Torvalds   2005-04-16  1764  		/* Argh. Not ready for write to buffer */
c172471b78255a5 Nicolas Pitre    2006-03-30  1765  		map_word Xstatus = map_read(map, cmd_adr);
^1da177e4c3f415 Linus Torvalds   2005-04-16  1766  		map_write(map, CMD(0x70), cmd_adr);
^1da177e4c3f415 Linus Torvalds   2005-04-16  1767  		chip->state = FL_STATUS;
c172471b78255a5 Nicolas Pitre    2006-03-30  1768  		status = map_read(map, cmd_adr);
^1da177e4c3f415 Linus Torvalds   2005-04-16  1769  		map_write(map, CMD(0x50), cmd_adr);
^1da177e4c3f415 Linus Torvalds   2005-04-16  1770  		map_write(map, CMD(0x70), cmd_adr);
^1da177e4c3f415 Linus Torvalds   2005-04-16  1771  		xip_enable(map, chip, cmd_adr);
c172471b78255a5 Nicolas Pitre    2006-03-30  1772  		printk(KERN_ERR "%s: Chip not ready for buffer write. Xstatus = %lx, status = %lx\n",
c172471b78255a5 Nicolas Pitre    2006-03-30  1773  				map->name, Xstatus.x[0], status.x[0]);
b8a0764c058e872 Andy Shevchenko  2026-01-24  1774  		return ret;
^1da177e4c3f415 Linus Torvalds   2005-04-16  1775  	}
^1da177e4c3f415 Linus Torvalds   2005-04-16  1776  
e102d54abf6806b Nicolas Pitre    2005-08-06  1777  	/* Figure out the number of words to write */
e102d54abf6806b Nicolas Pitre    2005-08-06  1778  	word_gap = (-adr & (map_bankwidth(map)-1));
c8872b069c53697 Julia Lawall     2008-08-02  1779  	words = DIV_ROUND_UP(len - word_gap, map_bankwidth(map));
e102d54abf6806b Nicolas Pitre    2005-08-06  1780  	if (!word_gap) {
e102d54abf6806b Nicolas Pitre    2005-08-06  1781  		words--;
e102d54abf6806b Nicolas Pitre    2005-08-06  1782  	} else {
e102d54abf6806b Nicolas Pitre    2005-08-06  1783  		word_gap = map_bankwidth(map) - word_gap;
e102d54abf6806b Nicolas Pitre    2005-08-06  1784  		adr -= word_gap;
e102d54abf6806b Nicolas Pitre    2005-08-06  1785  		datum = map_word_ff(map);
e102d54abf6806b Nicolas Pitre    2005-08-06  1786  	}
e102d54abf6806b Nicolas Pitre    2005-08-06  1787  
^1da177e4c3f415 Linus Torvalds   2005-04-16  1788  	/* Write length of data to come */
e102d54abf6806b Nicolas Pitre    2005-08-06  1789  	map_write(map, CMD(words), cmd_adr );
^1da177e4c3f415 Linus Torvalds   2005-04-16  1790  
^1da177e4c3f415 Linus Torvalds   2005-04-16  1791  	/* Write data */
e102d54abf6806b Nicolas Pitre    2005-08-06  1792  	vec = *pvec;
e102d54abf6806b Nicolas Pitre    2005-08-06  1793  	vec_seek = *pvec_seek;
e102d54abf6806b Nicolas Pitre    2005-08-06  1794  	do {
e102d54abf6806b Nicolas Pitre    2005-08-06  1795  		int n = map_bankwidth(map) - word_gap;
e102d54abf6806b Nicolas Pitre    2005-08-06  1796  		if (n > vec->iov_len - vec_seek)
e102d54abf6806b Nicolas Pitre    2005-08-06  1797  			n = vec->iov_len - vec_seek;
e102d54abf6806b Nicolas Pitre    2005-08-06  1798  		if (n > len)
e102d54abf6806b Nicolas Pitre    2005-08-06  1799  			n = len;
^1da177e4c3f415 Linus Torvalds   2005-04-16  1800  
e102d54abf6806b Nicolas Pitre    2005-08-06  1801  		if (!word_gap && len < map_bankwidth(map))
e102d54abf6806b Nicolas Pitre    2005-08-06  1802  			datum = map_word_ff(map);
^1da177e4c3f415 Linus Torvalds   2005-04-16  1803  
e102d54abf6806b Nicolas Pitre    2005-08-06  1804  		datum = map_word_load_partial(map, datum,
e102d54abf6806b Nicolas Pitre    2005-08-06  1805  					      vec->iov_base + vec_seek,
e102d54abf6806b Nicolas Pitre    2005-08-06  1806  					      word_gap, n);
^1da177e4c3f415 Linus Torvalds   2005-04-16  1807  
e102d54abf6806b Nicolas Pitre    2005-08-06  1808  		len -= n;
e102d54abf6806b Nicolas Pitre    2005-08-06  1809  		word_gap += n;
e102d54abf6806b Nicolas Pitre    2005-08-06  1810  		if (!len || word_gap == map_bankwidth(map)) {
e102d54abf6806b Nicolas Pitre    2005-08-06  1811  			map_write(map, datum, adr);
e102d54abf6806b Nicolas Pitre    2005-08-06  1812  			adr += map_bankwidth(map);
e102d54abf6806b Nicolas Pitre    2005-08-06  1813  			word_gap = 0;
e102d54abf6806b Nicolas Pitre    2005-08-06  1814  		}
e102d54abf6806b Nicolas Pitre    2005-08-06  1815  
e102d54abf6806b Nicolas Pitre    2005-08-06  1816  		vec_seek += n;
e102d54abf6806b Nicolas Pitre    2005-08-06  1817  		if (vec_seek == vec->iov_len) {
e102d54abf6806b Nicolas Pitre    2005-08-06  1818  			vec++;
e102d54abf6806b Nicolas Pitre    2005-08-06  1819  			vec_seek = 0;
^1da177e4c3f415 Linus Torvalds   2005-04-16  1820  		}
e102d54abf6806b Nicolas Pitre    2005-08-06  1821  	} while (len);
e102d54abf6806b Nicolas Pitre    2005-08-06  1822  	*pvec = vec;
e102d54abf6806b Nicolas Pitre    2005-08-06  1823  	*pvec_seek = vec_seek;
^1da177e4c3f415 Linus Torvalds   2005-04-16  1824  
^1da177e4c3f415 Linus Torvalds   2005-04-16  1825  	/* GO GO GO */
^1da177e4c3f415 Linus Torvalds   2005-04-16  1826  	map_write(map, CMD(0xd0), cmd_adr);
^1da177e4c3f415 Linus Torvalds   2005-04-16  1827  	chip->state = FL_WRITING;
^1da177e4c3f415 Linus Torvalds   2005-04-16  1828  
c172471b78255a5 Nicolas Pitre    2006-03-30  1829  	ret = INVAL_CACHE_AND_WAIT(map, chip, cmd_adr,
646fd12784d5061 Massimo Cirillo  2008-01-11  1830  				   initial_adr, initial_len,
e93cafe45fd7493 Anders Grafström 2008-08-05  1831  				   chip->buffer_write_time,
e93cafe45fd7493 Anders Grafström 2008-08-05  1832  				   chip->buffer_write_time_max);
c172471b78255a5 Nicolas Pitre    2006-03-30  1833  	if (ret) {
4843653cab0db03 Nicolas Pitre    2005-08-06  1834  		map_write(map, CMD(0x70), cmd_adr);
^1da177e4c3f415 Linus Torvalds   2005-04-16  1835  		chip->state = FL_STATUS;
^1da177e4c3f415 Linus Torvalds   2005-04-16  1836  		xip_enable(map, chip, cmd_adr);
4843653cab0db03 Nicolas Pitre    2005-08-06  1837  		printk(KERN_ERR "%s: buffer write error (status timeout)\n", map->name);
b8a0764c058e872 Andy Shevchenko  2026-01-24  1838  		return ret;
^1da177e4c3f415 Linus Torvalds   2005-04-16  1839  	}
^1da177e4c3f415 Linus Torvalds   2005-04-16  1840  
4843653cab0db03 Nicolas Pitre    2005-08-06  1841  	/* check for errors */
c172471b78255a5 Nicolas Pitre    2006-03-30  1842  	status = map_read(map, cmd_adr);
4843653cab0db03 Nicolas Pitre    2005-08-06  1843  	if (map_word_bitsset(map, status, CMD(0x1a))) {
4843653cab0db03 Nicolas Pitre    2005-08-06  1844  		unsigned long chipstatus = MERGESTATUS(status);
4843653cab0db03 Nicolas Pitre    2005-08-06  1845  
4843653cab0db03 Nicolas Pitre    2005-08-06  1846  		/* reset status */
^1da177e4c3f415 Linus Torvalds   2005-04-16  1847  		map_write(map, CMD(0x50), cmd_adr);
4843653cab0db03 Nicolas Pitre    2005-08-06  1848  		map_write(map, CMD(0x70), cmd_adr);
4843653cab0db03 Nicolas Pitre    2005-08-06  1849  		xip_enable(map, chip, cmd_adr);
4843653cab0db03 Nicolas Pitre    2005-08-06  1850  
b8a0764c058e872 Andy Shevchenko  2026-01-24  1851  		if (chipstatus & 0x02)
b8a0764c058e872 Andy Shevchenko  2026-01-24  1852  			return -EROFS;
b8a0764c058e872 Andy Shevchenko  2026-01-24  1853  
b8a0764c058e872 Andy Shevchenko  2026-01-24  1854  		if (chipstatus & 0x08) {
4843653cab0db03 Nicolas Pitre    2005-08-06  1855  			printk(KERN_ERR "%s: buffer write error (bad VPP)\n", map->name);
b8a0764c058e872 Andy Shevchenko  2026-01-24  1856  			return  -EIO;
4843653cab0db03 Nicolas Pitre    2005-08-06  1857  		}
4843653cab0db03 Nicolas Pitre    2005-08-06  1858  
b8a0764c058e872 Andy Shevchenko  2026-01-24  1859  		printk(KERN_ERR "%s: buffer write error (status 0x%lx)\n", map->name, chipstatus);
b8a0764c058e872 Andy Shevchenko  2026-01-24  1860  		return -EINVAL;
^1da177e4c3f415 Linus Torvalds   2005-04-16  1861  	}
^1da177e4c3f415 Linus Torvalds   2005-04-16  1862  
^1da177e4c3f415 Linus Torvalds   2005-04-16  1863  	xip_enable(map, chip, cmd_adr);
b8a0764c058e872 Andy Shevchenko  2026-01-24  1864  	return 0;
b8a0764c058e872 Andy Shevchenko  2026-01-24  1865  }
b8a0764c058e872 Andy Shevchenko  2026-01-24  1866  
Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
#2 lore raw
Quoted 25 lines · kernel test robot

Hi Andy,

kernel test robot noticed the following build warnings:

[auto build test WARNING on mtd/mtd/next]
[also build test WARNING on mtd/mtd/fixes linus/master v6.19-rc6 next-20260123] [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#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Andy-Shevchenko/mtd-cfi_cmdset_0001-Factor-out-do_write_buffer_locked-to-reduce-stack-frame/20260124-213936
base:   https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git mtd/next
patch link:    https://lore.kernel.org/r/20260124133730.3454241-1-andriy.shevchenko%40linux.intel.com
patch subject: [PATCH v2 1/1] mtd: cfi_cmdset_0001: Factor out do_write_buffer_locked() to reduce stack frame
config: xtensa-randconfig-002-20260125 (https://download.01.org/0day-ci/archive/20260125/[email protected]/config)
compiler: xtensa-linux-gcc (GCC) 8.5.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260125/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All warnings (new ones prefixed by >>):

Quoted 9 lines

drivers/mtd/chips/cfi_cmdset_0001.c: In function 'do_write_buffer_locked':

Quoted 1 line
Quoted 1 line

drivers/mtd/chips/cfi_cmdset_0001.c:1734:6: warning: unused variable 'initial_len' [-Wunused-variable]

     int initial_len = len;
         ^~~~~~~~~~~
Quoted 1 line
Quoted 1 line

drivers/mtd/chips/cfi_cmdset_0001.c:1733:16: warning: variable 'initial_adr' set but not used [-Wunused-but-set-variable]

     unsigned long initial_adr;
                   ^~~~~~~~~~~

Copying my response here again from [1] , as this LKP report seems to on a different thread:

Things become tricky with CONFIG_MTD_XIP enabled. With XIP_INVAL_CACHED_RANGE() moved to caller, initial_adr becomes unused when CONFIG_MTD_XIP=y

One solution maybe to move calls to XIP_INVAL_CACHED_RANGE(), ENABLE_VPP(map) and xip_disable() and their complementary functions to do_write_buffer_locked() as these calls need to repeated for every writes (if and when we find need to reuse do_write_buffer_locked())

Alternately move INVAL_CACHE_AND_WAIT() and everything after that to caller

[...]

[1] https://lore.kernel.org/all/[email protected]/

Signature · 3 lines
Regards
Vignesh
https://ti.com/opensource
#3 lore raw
Quoted 27 lines · Vignesh Raghavendra
Quoted 25 lines · kernel test robot

kernel test robot noticed the following build warnings:

[auto build test WARNING on mtd/mtd/next]
[also build test WARNING on mtd/mtd/fixes linus/master v6.19-rc6 next-20260123] [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#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Andy-Shevchenko/mtd-cfi_cmdset_0001-Factor-out-do_write_buffer_locked-to-reduce-stack-frame/20260124-213936
base:   https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git mtd/next
patch link:    https://lore.kernel.org/r/20260124133730.3454241-1-andriy.shevchenko%40linux.intel.com
patch subject: [PATCH v2 1/1] mtd: cfi_cmdset_0001: Factor out do_write_buffer_locked() to reduce stack frame
config: xtensa-randconfig-002-20260125 (https://download.01.org/0day-ci/archive/20260125/[email protected]/config)
compiler: xtensa-linux-gcc (GCC) 8.5.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260125/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All warnings (new ones prefixed by >>):

drivers/mtd/chips/cfi_cmdset_0001.c: In function 'do_write_buffer_locked':

Quoted 1 line
Quoted 1 line

drivers/mtd/chips/cfi_cmdset_0001.c:1734:6: warning: unused variable 'initial_len' [-Wunused-variable]

Quoted 8 lines
Quoted 5 lines
     int initial_len = len;
         ^~~~~~~~~~~
Quoted 1 line
Quoted 1 line

drivers/mtd/chips/cfi_cmdset_0001.c:1733:16: warning: variable 'initial_adr' set but not used [-Wunused-but-set-variable]

     unsigned long initial_adr;
                   ^~~~~~~~~~~

Copying my response here again from [1] , as this LKP report seems to on a different thread:

Thanks! I will look at this after -rc1 is out. Maybe earlier, but quite busy with other issue(s).

Quoted 11 lines

Things become tricky with CONFIG_MTD_XIP enabled. With XIP_INVAL_CACHED_RANGE() moved to caller, initial_adr becomes unused when CONFIG_MTD_XIP=y

One solution maybe to move calls to XIP_INVAL_CACHED_RANGE(), ENABLE_VPP(map) and xip_disable() and their complementary functions to do_write_buffer_locked() as these calls need to repeated for every writes (if and when we find need to reuse do_write_buffer_locked())

Alternately move INVAL_CACHE_AND_WAIT() and everything after that to caller

[...]

Quoted 1 line

[1] https://lore.kernel.org/all/[email protected]/

Signature · 2 lines
With Best Regards,
Andy Shevchenko