All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: oe-kbuild@lists.linux.dev
Cc: lkp@intel.com, Dan Carpenter <error27@gmail.com>
Subject: Re: [PATCH v5 2/3] mtd: rawnand: Add Cortina CS7542 controller support
Date: Tue, 1 Dec 2026 08:14:00 +0100	[thread overview]
Message-ID: <20261201080340.G4oDRTAt-lkp@intel.com> (raw)

Unfiltered warning: this smatch report is sent as-is and has not been
reviewed for false positives, so please treat it with due skepticism.

BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
In-Reply-To: <20261127-b4-cs7542-nand-v5-2-45b1a92bd13d@gmail.com>
References: <20261127-b4-cs7542-nand-v5-2-45b1a92bd13d@gmail.com>
TO: Fil Dunsky via B4 Relay <devnull+filipp.dunsky.gmail.com@kernel.org>
TO: Miquel Raynal <miquel.raynal@bootlin.com>
TO: Richard Weinberger <richard@nod.at>
TO: Vignesh Raghavendra <vigneshr@ti.com>
TO: Rob Herring <robh@kernel.org>
TO: Krzysztof Kozlowski <krzk@kernel.org>
TO: Conor Dooley <conor+dt@kernel.org>
TO: Philipp Zabel <p.zabel@pengutronix.de>
CC: linux-mtd@lists.infradead.org
CC: devicetree@vger.kernel.org
CC: linux-kernel@vger.kernel.org

Hi Fil,

kernel test robot noticed the following build warnings:

[auto build test WARNING on b6a9fa34ce4187cb69d3c588a4bbffc31ce5db8f]

url:    https://github.com/intel-lab-lkp/linux/commits/Fil-Dunsky-via-B4-Relay/dt-bindings-mtd-Add-Cortina-CS7542-NAND-controller/20261127-185404
base:   b6a9fa34ce4187cb69d3c588a4bbffc31ce5db8f
patch link:    https://lore.kernel.org/r/20261127-b4-cs7542-nand-v5-2-45b1a92bd13d%40gmail.com
patch subject: [PATCH v5 2/3] mtd: rawnand: Add Cortina CS7542 controller support
:::::: branch date: 4 days ago
:::::: commit date: 4 days ago
config: arm64-randconfig-2200-20261201 (https://download.01.org/0day-ci/archive/20261201/20261201080340.G4oDRTAt-lkp@intel.com/config)
compiler: aarch64-linux-gcc (GCC) 8.5.0
smatch: v0.5.0-9187-g5189e3fb

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 <lkp@intel.com>
| Reported-by: Dan Carpenter <error27@gmail.com>
| Closes: https://lore.kernel.org/r/20261201080340.G4oDRTAt-lkp@intel.com/

smatch warnings:
drivers/mtd/nand/raw/cs752x_nand.c:477 cs752x_nand_exec_op() error: we previously assumed 'p.data' could be null (see line 466)

vim +477 drivers/mtd/nand/raw/cs752x_nand.c

fef89bafa0003f3 Fil Dunsky 2026-11-27  453  
fef89bafa0003f3 Fil Dunsky 2026-11-27  454  static int cs752x_nand_exec_op(struct nand_chip *chip,
fef89bafa0003f3 Fil Dunsky 2026-11-27  455  			       const struct nand_operation *op, bool check_only)
fef89bafa0003f3 Fil Dunsky 2026-11-27  456  {
fef89bafa0003f3 Fil Dunsky 2026-11-27  457  	struct cs752x_nand_host *h = to_host(chip);
fef89bafa0003f3 Fil Dunsky 2026-11-27  458  	struct mtd_info *mtd = nand_to_mtd(chip);
fef89bafa0003f3 Fil Dunsky 2026-11-27  459  	struct cs752x_nand_op p;
fef89bafa0003f3 Fil Dunsky 2026-11-27  460  	unsigned int len, requested, col;
fef89bafa0003f3 Fil Dunsky 2026-11-27  461  	int ret;
fef89bafa0003f3 Fil Dunsky 2026-11-27  462  
fef89bafa0003f3 Fil Dunsky 2026-11-27  463  	ret = cs752x_nand_supports_op(op, &p);
fef89bafa0003f3 Fil Dunsky 2026-11-27  464  	if (ret || check_only)
fef89bafa0003f3 Fil Dunsky 2026-11-27  465  		return ret;
fef89bafa0003f3 Fil Dunsky 2026-11-27 @466  	requested = p.data ? p.data->ctx.data.len : 0;
fef89bafa0003f3 Fil Dunsky 2026-11-27  467  	if (!p.ncmds && p.wait_ready) {
fef89bafa0003f3 Fil Dunsky 2026-11-27  468  		ret = cs752x_nand_wait_ready(h, p.timeout_ms);
fef89bafa0003f3 Fil Dunsky 2026-11-27  469  		if (p.delay_ns)
fef89bafa0003f3 Fil Dunsky 2026-11-27  470  			ndelay(p.delay_ns);
fef89bafa0003f3 Fil Dunsky 2026-11-27  471  		return ret;
fef89bafa0003f3 Fil Dunsky 2026-11-27  472  	}
fef89bafa0003f3 Fil Dunsky 2026-11-27  473  	if (h->use_hwecc && p.data && p.ncmds == 2 &&
fef89bafa0003f3 Fil Dunsky 2026-11-27  474  	    p.naddrs >= 4 && !(p.address & 0xffff) &&
fef89bafa0003f3 Fil Dunsky 2026-11-27  475  	    requested == mtd->writesize)
fef89bafa0003f3 Fil Dunsky 2026-11-27  476  		return cs752x_nand_hwecc_op(h, &p);
fef89bafa0003f3 Fil Dunsky 2026-11-27 @477  	if (!p.ncmds && p.data->type == NAND_OP_DATA_OUT_INSTR) {
fef89bafa0003f3 Fil Dunsky 2026-11-27  478  		h->buf_data_len = 0;
fef89bafa0003f3 Fil Dunsky 2026-11-27  479  		h->buf_offs = 0;
fef89bafa0003f3 Fil Dunsky 2026-11-27  480  		return cs752x_nand_pio(h, &p, (u8 *)p.data->ctx.data.buf.out,
fef89bafa0003f3 Fil Dunsky 2026-11-27  481  				      requested, true);
fef89bafa0003f3 Fil Dunsky 2026-11-27  482  	}
fef89bafa0003f3 Fil Dunsky 2026-11-27  483  	if (!p.ncmds) {
fef89bafa0003f3 Fil Dunsky 2026-11-27  484  		if (h->read_mode != NAND_CMD_STATUS)
fef89bafa0003f3 Fil Dunsky 2026-11-27  485  			goto cached;
fef89bafa0003f3 Fil Dunsky 2026-11-27  486  		if (requested != 1)
fef89bafa0003f3 Fil Dunsky 2026-11-27  487  			return -EOPNOTSUPP;
fef89bafa0003f3 Fil Dunsky 2026-11-27  488  		p.command = NAND_CMD_STATUS;
fef89bafa0003f3 Fil Dunsky 2026-11-27  489  		p.ncmds = 1;
fef89bafa0003f3 Fil Dunsky 2026-11-27  490  	}
fef89bafa0003f3 Fil Dunsky 2026-11-27  491  	if (p.command == (NAND_CMD_RNDOUT | (NAND_CMD_RNDOUTSTART << 8))) {
fef89bafa0003f3 Fil Dunsky 2026-11-27  492  		col = p.address;
fef89bafa0003f3 Fil Dunsky 2026-11-27  493  		if (h->read_mode != NAND_CMD_PARAM && h->read_mode != NAND_CMD_READ0)
fef89bafa0003f3 Fil Dunsky 2026-11-27  494  			return -EINVAL;
fef89bafa0003f3 Fil Dunsky 2026-11-27  495  		if (col < h->cache_column || col - h->cache_column > h->buf_data_len)
fef89bafa0003f3 Fil Dunsky 2026-11-27  496  			return -EINVAL;
fef89bafa0003f3 Fil Dunsky 2026-11-27  497  		h->buf_offs = col - h->cache_column;
fef89bafa0003f3 Fil Dunsky 2026-11-27  498  		goto cached;
fef89bafa0003f3 Fil Dunsky 2026-11-27  499  	}
fef89bafa0003f3 Fil Dunsky 2026-11-27  500  	h->buf_offs = 0;
fef89bafa0003f3 Fil Dunsky 2026-11-27  501  	h->buf_data_len = 0;
fef89bafa0003f3 Fil Dunsky 2026-11-27  502  	h->read_mode = p.command & 0xff;
fef89bafa0003f3 Fil Dunsky 2026-11-27  503  	h->cache_column = 0;
fef89bafa0003f3 Fil Dunsky 2026-11-27  504  	len = p.data && p.data->type == NAND_OP_DATA_IN_INSTR ? requested : 0;
fef89bafa0003f3 Fil Dunsky 2026-11-27  505  	switch (p.command) {
fef89bafa0003f3 Fil Dunsky 2026-11-27  506  	case NAND_CMD_READID:
fef89bafa0003f3 Fil Dunsky 2026-11-27  507  		len = max(requested, 8U);
fef89bafa0003f3 Fil Dunsky 2026-11-27  508  		break;
fef89bafa0003f3 Fil Dunsky 2026-11-27  509  	case NAND_CMD_PARAM:
fef89bafa0003f3 Fil Dunsky 2026-11-27  510  		/* Keep all standard ONFI copies plus room for extended parameters. */
fef89bafa0003f3 Fil Dunsky 2026-11-27  511  		len = sizeof(h->own_buf);
fef89bafa0003f3 Fil Dunsky 2026-11-27  512  		break;
fef89bafa0003f3 Fil Dunsky 2026-11-27  513  	case NAND_CMD_STATUS:
fef89bafa0003f3 Fil Dunsky 2026-11-27  514  		len = 1;
fef89bafa0003f3 Fil Dunsky 2026-11-27  515  		break;
fef89bafa0003f3 Fil Dunsky 2026-11-27  516  	case NAND_CMD_READ0 | (NAND_CMD_READSTART << 8):
fef89bafa0003f3 Fil Dunsky 2026-11-27  517  		col = p.address & 0xffff;
fef89bafa0003f3 Fil Dunsky 2026-11-27  518  		if (col >= mtd->writesize + mtd->oobsize)
fef89bafa0003f3 Fil Dunsky 2026-11-27  519  			return -EINVAL;
fef89bafa0003f3 Fil Dunsky 2026-11-27  520  		h->cache_column = col;
fef89bafa0003f3 Fil Dunsky 2026-11-27  521  		len = mtd->writesize + mtd->oobsize - col;
fef89bafa0003f3 Fil Dunsky 2026-11-27  522  		break;
fef89bafa0003f3 Fil Dunsky 2026-11-27  523  	default:
fef89bafa0003f3 Fil Dunsky 2026-11-27  524  		break;
fef89bafa0003f3 Fil Dunsky 2026-11-27  525  	}
fef89bafa0003f3 Fil Dunsky 2026-11-27  526  	if (len > sizeof(h->own_buf) || (requested > len &&
fef89bafa0003f3 Fil Dunsky 2026-11-27  527  					 (!p.data || p.data->type == NAND_OP_DATA_IN_INSTR)))
fef89bafa0003f3 Fil Dunsky 2026-11-27  528  		return -EOPNOTSUPP;
fef89bafa0003f3 Fil Dunsky 2026-11-27  529  	if (p.data && p.data->type == NAND_OP_DATA_OUT_INSTR)
fef89bafa0003f3 Fil Dunsky 2026-11-27  530  		return cs752x_nand_pio(h, &p, (u8 *)p.data->ctx.data.buf.out,
fef89bafa0003f3 Fil Dunsky 2026-11-27  531  				      requested, true);
fef89bafa0003f3 Fil Dunsky 2026-11-27  532  
fef89bafa0003f3 Fil Dunsky 2026-11-27  533  	ret = cs752x_nand_pio(h, &p, h->own_buf, len,
fef89bafa0003f3 Fil Dunsky 2026-11-27  534  			      p.command == NAND_CMD_RESET);
fef89bafa0003f3 Fil Dunsky 2026-11-27  535  	if (ret)
fef89bafa0003f3 Fil Dunsky 2026-11-27  536  		return ret;
fef89bafa0003f3 Fil Dunsky 2026-11-27  537  	h->buf_data_len = len;
fef89bafa0003f3 Fil Dunsky 2026-11-27  538  cached:
fef89bafa0003f3 Fil Dunsky 2026-11-27  539  	if (!requested)
fef89bafa0003f3 Fil Dunsky 2026-11-27  540  		return 0;
fef89bafa0003f3 Fil Dunsky 2026-11-27  541  	if (h->buf_offs > h->buf_data_len ||
fef89bafa0003f3 Fil Dunsky 2026-11-27  542  	    requested > h->buf_data_len - h->buf_offs)
fef89bafa0003f3 Fil Dunsky 2026-11-27  543  		return -EOPNOTSUPP;
fef89bafa0003f3 Fil Dunsky 2026-11-27  544  	memcpy(p.data->ctx.data.buf.in, h->own_buf + h->buf_offs, requested);
fef89bafa0003f3 Fil Dunsky 2026-11-27  545  	h->buf_offs += requested;
fef89bafa0003f3 Fil Dunsky 2026-11-27  546  	return 0;
fef89bafa0003f3 Fil Dunsky 2026-11-27  547  }
fef89bafa0003f3 Fil Dunsky 2026-11-27  548  

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

             reply	other threads:[~2026-12-01  7:14 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-01  7:14 kernel test robot [this message]
  -- strict thread matches above, loose matches on Subject: below --
2026-11-27 15:54 [PATCH v5 0/3] Add Cortina Systems CS7542 NAND controller support Fil Dunsky
2026-11-27 15:54 ` [PATCH v5 2/3] mtd: rawnand: Add Cortina CS7542 " Fil Dunsky
2026-11-27 15:54   ` Fil Dunsky via B4 Relay
2026-11-27 15:54   ` Fil Dunsky via B4 Relay

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=20261201080340.G4oDRTAt-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=error27@gmail.com \
    --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.