All of lore.kernel.org
 help / color / mirror / Atom feed
* drivers/spi/spi-nxp-xspi.c:783:25-26: WARNING opportunity for max()
@ 2026-07-12  6:14 kernel test robot
  0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2026-07-12  6:14 UTC (permalink / raw)
  To: oe-kbuild; +Cc: lkp, Julia Lawall

BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
CC: linux-kernel@vger.kernel.org
TO: Haibo Chen <haibo.chen@nxp.com>
CC: Mark Brown <broonie@kernel.org>
CC: Frank Li <Frank.Li@nxp.com>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   dd3210c47e8d3ac6b4e9141fc68acc03b38c0ba3
commit: 29c8c00d9f9db5fb659b6f05f9e8964afc13f3e2 spi: add driver for NXP XSPI controller
date:   7 months ago
:::::: branch date: 28 hours ago
:::::: commit date: 7 months ago
config: hexagon-randconfig-r051-20260709 (https://download.01.org/0day-ci/archive/20260712/202607121428.xBcRYuef-lkp@intel.com/config)
compiler: clang version 23.0.0git (https://github.com/llvm/llvm-project c279890c85da307abe34f10333442bbf72a60644)

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
| Fixes: 29c8c00d9f9d ("spi: add driver for NXP XSPI controller")
| Reported-by: kernel test robot <lkp@intel.com>
| Reported-by: Julia Lawall <julia.lawall@inria.fr>
| Closes: https://lore.kernel.org/r/202607121428.xBcRYuef-lkp@intel.com/

cocci warnings: (new ones prefixed by >>)
>> drivers/spi/spi-nxp-xspi.c:783:25-26: WARNING opportunity for max()

vim +783 drivers/spi/spi-nxp-xspi.c

29c8c00d9f9db5 Haibo Chen 2025-12-16  770  
29c8c00d9f9db5 Haibo Chen 2025-12-16  771  static int nxp_xspi_ahb_read(struct nxp_xspi *xspi, const struct spi_mem_op *op)
29c8c00d9f9db5 Haibo Chen 2025-12-16  772  {
29c8c00d9f9db5 Haibo Chen 2025-12-16  773  	u32 start = op->addr.val;
29c8c00d9f9db5 Haibo Chen 2025-12-16  774  	u32 len = op->data.nbytes;
29c8c00d9f9db5 Haibo Chen 2025-12-16  775  
29c8c00d9f9db5 Haibo Chen 2025-12-16  776  	/* If necessary, ioremap before AHB read */
29c8c00d9f9db5 Haibo Chen 2025-12-16  777  	if ((!xspi->ahb_addr) || start < xspi->memmap_start ||
29c8c00d9f9db5 Haibo Chen 2025-12-16  778  	     start + len > xspi->memmap_start + xspi->memmap_len) {
29c8c00d9f9db5 Haibo Chen 2025-12-16  779  		if (xspi->ahb_addr)
29c8c00d9f9db5 Haibo Chen 2025-12-16  780  			iounmap(xspi->ahb_addr);
29c8c00d9f9db5 Haibo Chen 2025-12-16  781  
29c8c00d9f9db5 Haibo Chen 2025-12-16  782  		xspi->memmap_start = start;
29c8c00d9f9db5 Haibo Chen 2025-12-16 @783  		xspi->memmap_len = len > NXP_XSPI_MIN_IOMAP ?
29c8c00d9f9db5 Haibo Chen 2025-12-16  784  				len : NXP_XSPI_MIN_IOMAP;
29c8c00d9f9db5 Haibo Chen 2025-12-16  785  
29c8c00d9f9db5 Haibo Chen 2025-12-16  786  		xspi->ahb_addr = ioremap(xspi->memmap_phy + xspi->memmap_start,
29c8c00d9f9db5 Haibo Chen 2025-12-16  787  					 xspi->memmap_len);
29c8c00d9f9db5 Haibo Chen 2025-12-16  788  
29c8c00d9f9db5 Haibo Chen 2025-12-16  789  		if (!xspi->ahb_addr) {
29c8c00d9f9db5 Haibo Chen 2025-12-16  790  			dev_err(xspi->dev, "failed to alloc memory\n");
29c8c00d9f9db5 Haibo Chen 2025-12-16  791  			return -ENOMEM;
29c8c00d9f9db5 Haibo Chen 2025-12-16  792  		}
29c8c00d9f9db5 Haibo Chen 2025-12-16  793  	}
29c8c00d9f9db5 Haibo Chen 2025-12-16  794  
29c8c00d9f9db5 Haibo Chen 2025-12-16  795  	/* Read out the data directly from the AHB buffer. */
29c8c00d9f9db5 Haibo Chen 2025-12-16  796  	memcpy_fromio(op->data.buf.in,
29c8c00d9f9db5 Haibo Chen 2025-12-16  797  			xspi->ahb_addr + start - xspi->memmap_start, len);
29c8c00d9f9db5 Haibo Chen 2025-12-16  798  
29c8c00d9f9db5 Haibo Chen 2025-12-16  799  	return 0;
29c8c00d9f9db5 Haibo Chen 2025-12-16  800  }
29c8c00d9f9db5 Haibo Chen 2025-12-16  801  

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-07-12  6:15 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-12  6:14 drivers/spi/spi-nxp-xspi.c:783:25-26: WARNING opportunity for max() kernel test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.