* [broonie-spi:for-6.15 10/22] drivers/spi/spi-sg2044-nor.c:243 sg2044_spifmc_write() warn: unsigned 'ret' is never less than zero.
@ 2025-03-15 5:32 kernel test robot
0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2025-03-15 5:32 UTC (permalink / raw)
To: Longbin Li; +Cc: oe-kbuild-all, linux-spi, Mark Brown
tree: https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-6.15
head: 336a41c90c86b883aa06ed19f138eee19ddf9958
commit: de16c322eefbe9026d4eabc8ae934bb778cffd1d [10/22] spi: sophgo: add SG2044 SPI NOR controller driver
config: openrisc-randconfig-r072-20250314 (https://download.01.org/0day-ci/archive/20250315/202503151344.DRTW7z9o-lkp@intel.com/config)
compiler: or1k-linux-gcc (GCC) 14.2.0
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>
| Closes: https://lore.kernel.org/oe-kbuild-all/202503151344.DRTW7z9o-lkp@intel.com/
New smatch warnings:
drivers/spi/spi-sg2044-nor.c:243 sg2044_spifmc_write() warn: unsigned 'ret' is never less than zero.
drivers/spi/spi-sg2044-nor.c:450 sg2044_spifmc_probe() error: uninitialized symbol 'base'.
Old smatch warnings:
drivers/spi/spi-sg2044-nor.c:253 sg2044_spifmc_write() warn: unsigned 'ret' is never less than zero.
drivers/spi/spi-sg2044-nor.c:263 sg2044_spifmc_write() warn: unsigned 'ret' is never less than zero.
vim +/ret +243 drivers/spi/spi-sg2044-nor.c
212
213 static ssize_t sg2044_spifmc_write(struct sg2044_spifmc *spifmc,
214 const struct spi_mem_op *op)
215 {
216 size_t xfer_size;
217 const u8 *dout = op->data.buf.out;
218 int i, offset;
219 size_t ret;
220 u32 reg;
221
222 reg = sg2044_spifmc_init_reg(spifmc);
223 reg |= (op->addr.nbytes + op->dummy.nbytes) << SPIFMC_TRAN_CSR_ADDR_BYTES_SHIFT;
224 reg |= SPIFMC_TRAN_CSR_FIFO_TRG_LVL_8_BYTE;
225 reg |= SPIFMC_TRAN_CSR_WITH_CMD;
226 reg |= SPIFMC_TRAN_CSR_TRAN_MODE_TX;
227
228 writel(0, spifmc->io_base + SPIFMC_FIFO_PT);
229 writeb(op->cmd.opcode, spifmc->io_base + SPIFMC_FIFO_PORT);
230
231 for (i = op->addr.nbytes - 1; i >= 0; i--)
232 writeb((op->addr.val >> i * 8) & 0xff, spifmc->io_base + SPIFMC_FIFO_PORT);
233
234 for (i = 0; i < op->dummy.nbytes; i++)
235 writeb(0xff, spifmc->io_base + SPIFMC_FIFO_PORT);
236
237 writel(0, spifmc->io_base + SPIFMC_INT_STS);
238 writel(op->data.nbytes, spifmc->io_base + SPIFMC_TRAN_NUM);
239 reg |= SPIFMC_TRAN_CSR_GO_BUSY;
240 writel(reg, spifmc->io_base + SPIFMC_TRAN_CSR);
241
242 ret = sg2044_spifmc_wait_xfer_size(spifmc, 0);
> 243 if (ret < 0)
244 return ret;
245
246 writel(0, spifmc->io_base + SPIFMC_FIFO_PT);
247
248 offset = 0;
249 while (offset < op->data.nbytes) {
250 xfer_size = min_t(size_t, SPIFMC_MAX_FIFO_DEPTH, op->data.nbytes - offset);
251
252 ret = sg2044_spifmc_wait_xfer_size(spifmc, 0);
253 if (ret < 0)
254 return ret;
255
256 for (i = 0; i < xfer_size; i++)
257 writeb(dout[i + offset], spifmc->io_base + SPIFMC_FIFO_PORT);
258
259 offset += xfer_size;
260 }
261
262 ret = sg2044_spifmc_wait_int(spifmc, SPIFMC_INT_TRAN_DONE);
263 if (ret < 0)
264 return ret;
265
266 writel(0, spifmc->io_base + SPIFMC_FIFO_PT);
267
268 return 0;
269 }
270
--
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:[~2025-03-15 5:32 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-15 5:32 [broonie-spi:for-6.15 10/22] drivers/spi/spi-sg2044-nor.c:243 sg2044_spifmc_write() warn: unsigned 'ret' is never less than zero kernel test robot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).