From: kernel test robot <lkp@intel.com>
To: oe-kbuild@lists.linux.dev
Cc: lkp@intel.com, Julia Lawall <julia.lawall@inria.fr>
Subject: drivers/spi/spi-nxp-xspi.c:783:25-26: WARNING opportunity for max()
Date: Sun, 12 Jul 2026 14:14:20 +0800 [thread overview]
Message-ID: <202607121428.xBcRYuef-lkp@intel.com> (raw)
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
reply other threads:[~2026-07-12 6:15 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=202607121428.xBcRYuef-lkp@intel.com \
--to=lkp@intel.com \
--cc=julia.lawall@inria.fr \
--cc=oe-kbuild@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.