[<prev] [next>] [day] [month] [year] [list]
Message-ID: <202011131956.egklXLCS-lkp@intel.com>
Date: Fri, 13 Nov 2020 19:37:05 +0800
From: kernel test robot <lkp@...el.com>
To: Krzysztof Kozlowski <krzk@...nel.org>
Cc: kbuild-all@...ts.01.org, linux-kernel@...r.kernel.org,
Ulf Hansson <ulf.hansson@...aro.org>
Subject: drivers/mmc/host/moxart-mmc.c:260:7: warning: variable 'dma_time'
set but not used
Hi Krzysztof,
FYI, the error/warning still remains.
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 585e5b17b92dead8a3aca4e3c9876fbca5f7e0ba
commit: 54d8454436a205682bd89d66d8d9eedbc8452d15 mmc: host: Enable compile testing of multiple drivers
date: 10 weeks ago
config: h8300-randconfig-r013-20201105 (attached as .config)
compiler: h8300-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=54d8454436a205682bd89d66d8d9eedbc8452d15
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout 54d8454436a205682bd89d66d8d9eedbc8452d15
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=h8300
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@...el.com>
All warnings (new ones prefixed by >>):
In file included from include/linux/kernel.h:11,
from include/linux/list.h:9,
from include/linux/module.h:12,
from drivers/mmc/host/moxart-mmc.c:16:
include/linux/scatterlist.h: In function 'sg_set_buf':
include/asm-generic/page.h:93:50: warning: ordered comparison of pointer with null pointer [-Wextra]
93 | #define virt_addr_valid(kaddr) (((void *)(kaddr) >= (void *)PAGE_OFFSET) && \
| ^~
include/linux/compiler.h:78:42: note: in definition of macro 'unlikely'
78 | # define unlikely(x) __builtin_expect(!!(x), 0)
| ^
include/linux/scatterlist.h:143:2: note: in expansion of macro 'BUG_ON'
143 | BUG_ON(!virt_addr_valid(buf));
| ^~~~~~
include/linux/scatterlist.h:143:10: note: in expansion of macro 'virt_addr_valid'
143 | BUG_ON(!virt_addr_valid(buf));
| ^~~~~~~~~~~~~~~
drivers/mmc/host/moxart-mmc.c: In function 'moxart_transfer_dma':
>> drivers/mmc/host/moxart-mmc.c:260:7: warning: variable 'dma_time' set but not used [-Wunused-but-set-variable]
260 | long dma_time;
| ^~~~~~~~
drivers/mmc/host/moxart-mmc.c: In function 'moxart_request':
>> drivers/mmc/host/moxart-mmc.c:398:7: warning: variable 'pio_time' set but not used [-Wunused-but-set-variable]
398 | long pio_time;
| ^~~~~~~~
vim +/dma_time +260 drivers/mmc/host/moxart-mmc.c
1b66e94e6b99953 Jonas Jensen 2014-04-09 256
1b66e94e6b99953 Jonas Jensen 2014-04-09 257 static void moxart_transfer_dma(struct mmc_data *data, struct moxart_host *host)
1b66e94e6b99953 Jonas Jensen 2014-04-09 258 {
feeef096a770d28 Heiner Kallweit 2017-03-26 259 u32 len, dir_slave;
41f469cac2663a4 Nicholas Mc Guire 2016-07-25 @260 long dma_time;
1b66e94e6b99953 Jonas Jensen 2014-04-09 261 struct dma_async_tx_descriptor *desc = NULL;
1b66e94e6b99953 Jonas Jensen 2014-04-09 262 struct dma_chan *dma_chan;
1b66e94e6b99953 Jonas Jensen 2014-04-09 263
1b66e94e6b99953 Jonas Jensen 2014-04-09 264 if (host->data_len == data->bytes_xfered)
1b66e94e6b99953 Jonas Jensen 2014-04-09 265 return;
1b66e94e6b99953 Jonas Jensen 2014-04-09 266
1b66e94e6b99953 Jonas Jensen 2014-04-09 267 if (data->flags & MMC_DATA_WRITE) {
1b66e94e6b99953 Jonas Jensen 2014-04-09 268 dma_chan = host->dma_chan_tx;
1b66e94e6b99953 Jonas Jensen 2014-04-09 269 dir_slave = DMA_MEM_TO_DEV;
1b66e94e6b99953 Jonas Jensen 2014-04-09 270 } else {
1b66e94e6b99953 Jonas Jensen 2014-04-09 271 dma_chan = host->dma_chan_rx;
1b66e94e6b99953 Jonas Jensen 2014-04-09 272 dir_slave = DMA_DEV_TO_MEM;
1b66e94e6b99953 Jonas Jensen 2014-04-09 273 }
1b66e94e6b99953 Jonas Jensen 2014-04-09 274
1b66e94e6b99953 Jonas Jensen 2014-04-09 275 len = dma_map_sg(dma_chan->device->dev, data->sg,
feeef096a770d28 Heiner Kallweit 2017-03-26 276 data->sg_len, mmc_get_dma_dir(data));
1b66e94e6b99953 Jonas Jensen 2014-04-09 277
1b66e94e6b99953 Jonas Jensen 2014-04-09 278 if (len > 0) {
1b66e94e6b99953 Jonas Jensen 2014-04-09 279 desc = dmaengine_prep_slave_sg(dma_chan, data->sg,
1b66e94e6b99953 Jonas Jensen 2014-04-09 280 len, dir_slave,
1b66e94e6b99953 Jonas Jensen 2014-04-09 281 DMA_PREP_INTERRUPT |
1b66e94e6b99953 Jonas Jensen 2014-04-09 282 DMA_CTRL_ACK);
1b66e94e6b99953 Jonas Jensen 2014-04-09 283 } else {
1b66e94e6b99953 Jonas Jensen 2014-04-09 284 dev_err(mmc_dev(host->mmc), "dma_map_sg returned zero length\n");
1b66e94e6b99953 Jonas Jensen 2014-04-09 285 }
1b66e94e6b99953 Jonas Jensen 2014-04-09 286
1b66e94e6b99953 Jonas Jensen 2014-04-09 287 if (desc) {
1b66e94e6b99953 Jonas Jensen 2014-04-09 288 host->tx_desc = desc;
1b66e94e6b99953 Jonas Jensen 2014-04-09 289 desc->callback = moxart_dma_complete;
1b66e94e6b99953 Jonas Jensen 2014-04-09 290 desc->callback_param = host;
1b66e94e6b99953 Jonas Jensen 2014-04-09 291 dmaengine_submit(desc);
1b66e94e6b99953 Jonas Jensen 2014-04-09 292 dma_async_issue_pending(dma_chan);
1b66e94e6b99953 Jonas Jensen 2014-04-09 293 }
1b66e94e6b99953 Jonas Jensen 2014-04-09 294
1b66e94e6b99953 Jonas Jensen 2014-04-09 295 data->bytes_xfered += host->data_remain;
1b66e94e6b99953 Jonas Jensen 2014-04-09 296
1b66e94e6b99953 Jonas Jensen 2014-04-09 297 dma_time = wait_for_completion_interruptible_timeout(
1b66e94e6b99953 Jonas Jensen 2014-04-09 298 &host->dma_complete, host->timeout);
1b66e94e6b99953 Jonas Jensen 2014-04-09 299
1b66e94e6b99953 Jonas Jensen 2014-04-09 300 dma_unmap_sg(dma_chan->device->dev,
1b66e94e6b99953 Jonas Jensen 2014-04-09 301 data->sg, data->sg_len,
feeef096a770d28 Heiner Kallweit 2017-03-26 302 mmc_get_dma_dir(data));
1b66e94e6b99953 Jonas Jensen 2014-04-09 303 }
1b66e94e6b99953 Jonas Jensen 2014-04-09 304
1b66e94e6b99953 Jonas Jensen 2014-04-09 305
1b66e94e6b99953 Jonas Jensen 2014-04-09 306 static void moxart_transfer_pio(struct moxart_host *host)
1b66e94e6b99953 Jonas Jensen 2014-04-09 307 {
1b66e94e6b99953 Jonas Jensen 2014-04-09 308 struct mmc_data *data = host->mrq->cmd->data;
1b66e94e6b99953 Jonas Jensen 2014-04-09 309 u32 *sgp, len = 0, remain, status;
1b66e94e6b99953 Jonas Jensen 2014-04-09 310
1b66e94e6b99953 Jonas Jensen 2014-04-09 311 if (host->data_len == data->bytes_xfered)
1b66e94e6b99953 Jonas Jensen 2014-04-09 312 return;
1b66e94e6b99953 Jonas Jensen 2014-04-09 313
1b66e94e6b99953 Jonas Jensen 2014-04-09 314 sgp = sg_virt(host->cur_sg);
1b66e94e6b99953 Jonas Jensen 2014-04-09 315 remain = host->data_remain;
1b66e94e6b99953 Jonas Jensen 2014-04-09 316
1b66e94e6b99953 Jonas Jensen 2014-04-09 317 if (data->flags & MMC_DATA_WRITE) {
1b66e94e6b99953 Jonas Jensen 2014-04-09 318 while (remain > 0) {
1b66e94e6b99953 Jonas Jensen 2014-04-09 319 if (moxart_wait_for_status(host, FIFO_URUN, &status)
1b66e94e6b99953 Jonas Jensen 2014-04-09 320 == -ETIMEDOUT) {
1b66e94e6b99953 Jonas Jensen 2014-04-09 321 data->error = -ETIMEDOUT;
1b66e94e6b99953 Jonas Jensen 2014-04-09 322 complete(&host->pio_complete);
1b66e94e6b99953 Jonas Jensen 2014-04-09 323 return;
1b66e94e6b99953 Jonas Jensen 2014-04-09 324 }
1b66e94e6b99953 Jonas Jensen 2014-04-09 325 for (len = 0; len < remain && len < host->fifo_width;) {
1b66e94e6b99953 Jonas Jensen 2014-04-09 326 iowrite32(*sgp, host->base + REG_DATA_WINDOW);
1b66e94e6b99953 Jonas Jensen 2014-04-09 327 sgp++;
1b66e94e6b99953 Jonas Jensen 2014-04-09 328 len += 4;
1b66e94e6b99953 Jonas Jensen 2014-04-09 329 }
1b66e94e6b99953 Jonas Jensen 2014-04-09 330 remain -= len;
1b66e94e6b99953 Jonas Jensen 2014-04-09 331 }
1b66e94e6b99953 Jonas Jensen 2014-04-09 332
1b66e94e6b99953 Jonas Jensen 2014-04-09 333 } else {
1b66e94e6b99953 Jonas Jensen 2014-04-09 334 while (remain > 0) {
1b66e94e6b99953 Jonas Jensen 2014-04-09 335 if (moxart_wait_for_status(host, FIFO_ORUN, &status)
1b66e94e6b99953 Jonas Jensen 2014-04-09 336 == -ETIMEDOUT) {
1b66e94e6b99953 Jonas Jensen 2014-04-09 337 data->error = -ETIMEDOUT;
1b66e94e6b99953 Jonas Jensen 2014-04-09 338 complete(&host->pio_complete);
1b66e94e6b99953 Jonas Jensen 2014-04-09 339 return;
1b66e94e6b99953 Jonas Jensen 2014-04-09 340 }
1b66e94e6b99953 Jonas Jensen 2014-04-09 341 for (len = 0; len < remain && len < host->fifo_width;) {
1b66e94e6b99953 Jonas Jensen 2014-04-09 342 /* SCR data must be read in big endian. */
1b66e94e6b99953 Jonas Jensen 2014-04-09 343 if (data->mrq->cmd->opcode == SD_APP_SEND_SCR)
1b66e94e6b99953 Jonas Jensen 2014-04-09 344 *sgp = ioread32be(host->base +
1b66e94e6b99953 Jonas Jensen 2014-04-09 345 REG_DATA_WINDOW);
1b66e94e6b99953 Jonas Jensen 2014-04-09 346 else
1b66e94e6b99953 Jonas Jensen 2014-04-09 347 *sgp = ioread32(host->base +
1b66e94e6b99953 Jonas Jensen 2014-04-09 348 REG_DATA_WINDOW);
1b66e94e6b99953 Jonas Jensen 2014-04-09 349 sgp++;
1b66e94e6b99953 Jonas Jensen 2014-04-09 350 len += 4;
1b66e94e6b99953 Jonas Jensen 2014-04-09 351 }
1b66e94e6b99953 Jonas Jensen 2014-04-09 352 remain -= len;
1b66e94e6b99953 Jonas Jensen 2014-04-09 353 }
1b66e94e6b99953 Jonas Jensen 2014-04-09 354 }
1b66e94e6b99953 Jonas Jensen 2014-04-09 355
1b66e94e6b99953 Jonas Jensen 2014-04-09 356 data->bytes_xfered += host->data_remain - remain;
1b66e94e6b99953 Jonas Jensen 2014-04-09 357 host->data_remain = remain;
1b66e94e6b99953 Jonas Jensen 2014-04-09 358
1b66e94e6b99953 Jonas Jensen 2014-04-09 359 if (host->data_len != data->bytes_xfered)
1b66e94e6b99953 Jonas Jensen 2014-04-09 360 moxart_next_sg(host);
1b66e94e6b99953 Jonas Jensen 2014-04-09 361 else
1b66e94e6b99953 Jonas Jensen 2014-04-09 362 complete(&host->pio_complete);
1b66e94e6b99953 Jonas Jensen 2014-04-09 363 }
1b66e94e6b99953 Jonas Jensen 2014-04-09 364
1b66e94e6b99953 Jonas Jensen 2014-04-09 365 static void moxart_prepare_data(struct moxart_host *host)
1b66e94e6b99953 Jonas Jensen 2014-04-09 366 {
1b66e94e6b99953 Jonas Jensen 2014-04-09 367 struct mmc_data *data = host->mrq->cmd->data;
1b66e94e6b99953 Jonas Jensen 2014-04-09 368 u32 datactrl;
1b66e94e6b99953 Jonas Jensen 2014-04-09 369 int blksz_bits;
1b66e94e6b99953 Jonas Jensen 2014-04-09 370
1b66e94e6b99953 Jonas Jensen 2014-04-09 371 if (!data)
1b66e94e6b99953 Jonas Jensen 2014-04-09 372 return;
1b66e94e6b99953 Jonas Jensen 2014-04-09 373
1b66e94e6b99953 Jonas Jensen 2014-04-09 374 host->data_len = data->blocks * data->blksz;
1b66e94e6b99953 Jonas Jensen 2014-04-09 375 blksz_bits = ffs(data->blksz) - 1;
1b66e94e6b99953 Jonas Jensen 2014-04-09 376 BUG_ON(1 << blksz_bits != data->blksz);
1b66e94e6b99953 Jonas Jensen 2014-04-09 377
1b66e94e6b99953 Jonas Jensen 2014-04-09 378 moxart_init_sg(host, data);
1b66e94e6b99953 Jonas Jensen 2014-04-09 379
1b66e94e6b99953 Jonas Jensen 2014-04-09 380 datactrl = DCR_DATA_EN | (blksz_bits & DCR_BLK_SIZE);
1b66e94e6b99953 Jonas Jensen 2014-04-09 381
1b66e94e6b99953 Jonas Jensen 2014-04-09 382 if (data->flags & MMC_DATA_WRITE)
1b66e94e6b99953 Jonas Jensen 2014-04-09 383 datactrl |= DCR_DATA_WRITE;
1b66e94e6b99953 Jonas Jensen 2014-04-09 384
1b66e94e6b99953 Jonas Jensen 2014-04-09 385 if ((host->data_len > host->fifo_width) && host->have_dma)
1b66e94e6b99953 Jonas Jensen 2014-04-09 386 datactrl |= DCR_DMA_EN;
1b66e94e6b99953 Jonas Jensen 2014-04-09 387
1b66e94e6b99953 Jonas Jensen 2014-04-09 388 writel(DCR_DATA_FIFO_RESET, host->base + REG_DATA_CONTROL);
1b66e94e6b99953 Jonas Jensen 2014-04-09 389 writel(MASK_DATA | FIFO_URUN | FIFO_ORUN, host->base + REG_CLEAR);
1b66e94e6b99953 Jonas Jensen 2014-04-09 390 writel(host->rate, host->base + REG_DATA_TIMER);
1b66e94e6b99953 Jonas Jensen 2014-04-09 391 writel(host->data_len, host->base + REG_DATA_LENGTH);
1b66e94e6b99953 Jonas Jensen 2014-04-09 392 writel(datactrl, host->base + REG_DATA_CONTROL);
1b66e94e6b99953 Jonas Jensen 2014-04-09 393 }
1b66e94e6b99953 Jonas Jensen 2014-04-09 394
1b66e94e6b99953 Jonas Jensen 2014-04-09 395 static void moxart_request(struct mmc_host *mmc, struct mmc_request *mrq)
1b66e94e6b99953 Jonas Jensen 2014-04-09 396 {
1b66e94e6b99953 Jonas Jensen 2014-04-09 397 struct moxart_host *host = mmc_priv(mmc);
41f469cac2663a4 Nicholas Mc Guire 2016-07-25 @398 long pio_time;
41f469cac2663a4 Nicholas Mc Guire 2016-07-25 399 unsigned long flags;
1b66e94e6b99953 Jonas Jensen 2014-04-09 400 u32 status;
1b66e94e6b99953 Jonas Jensen 2014-04-09 401
1b66e94e6b99953 Jonas Jensen 2014-04-09 402 spin_lock_irqsave(&host->lock, flags);
1b66e94e6b99953 Jonas Jensen 2014-04-09 403
1b66e94e6b99953 Jonas Jensen 2014-04-09 404 init_completion(&host->dma_complete);
1b66e94e6b99953 Jonas Jensen 2014-04-09 405 init_completion(&host->pio_complete);
1b66e94e6b99953 Jonas Jensen 2014-04-09 406
1b66e94e6b99953 Jonas Jensen 2014-04-09 407 host->mrq = mrq;
1b66e94e6b99953 Jonas Jensen 2014-04-09 408
1b66e94e6b99953 Jonas Jensen 2014-04-09 409 if (readl(host->base + REG_STATUS) & CARD_DETECT) {
1b66e94e6b99953 Jonas Jensen 2014-04-09 410 mrq->cmd->error = -ETIMEDOUT;
1b66e94e6b99953 Jonas Jensen 2014-04-09 411 goto request_done;
1b66e94e6b99953 Jonas Jensen 2014-04-09 412 }
1b66e94e6b99953 Jonas Jensen 2014-04-09 413
1b66e94e6b99953 Jonas Jensen 2014-04-09 414 moxart_prepare_data(host);
1b66e94e6b99953 Jonas Jensen 2014-04-09 415 moxart_send_command(host, host->mrq->cmd);
1b66e94e6b99953 Jonas Jensen 2014-04-09 416
1b66e94e6b99953 Jonas Jensen 2014-04-09 417 if (mrq->cmd->data) {
1b66e94e6b99953 Jonas Jensen 2014-04-09 418 if ((host->data_len > host->fifo_width) && host->have_dma) {
1b66e94e6b99953 Jonas Jensen 2014-04-09 419
1b66e94e6b99953 Jonas Jensen 2014-04-09 420 writel(CARD_CHANGE, host->base + REG_INTERRUPT_MASK);
1b66e94e6b99953 Jonas Jensen 2014-04-09 421
1b66e94e6b99953 Jonas Jensen 2014-04-09 422 spin_unlock_irqrestore(&host->lock, flags);
1b66e94e6b99953 Jonas Jensen 2014-04-09 423
1b66e94e6b99953 Jonas Jensen 2014-04-09 424 moxart_transfer_dma(mrq->cmd->data, host);
1b66e94e6b99953 Jonas Jensen 2014-04-09 425
1b66e94e6b99953 Jonas Jensen 2014-04-09 426 spin_lock_irqsave(&host->lock, flags);
1b66e94e6b99953 Jonas Jensen 2014-04-09 427 } else {
1b66e94e6b99953 Jonas Jensen 2014-04-09 428
1b66e94e6b99953 Jonas Jensen 2014-04-09 429 writel(MASK_INTR_PIO, host->base + REG_INTERRUPT_MASK);
1b66e94e6b99953 Jonas Jensen 2014-04-09 430
1b66e94e6b99953 Jonas Jensen 2014-04-09 431 spin_unlock_irqrestore(&host->lock, flags);
1b66e94e6b99953 Jonas Jensen 2014-04-09 432
1b66e94e6b99953 Jonas Jensen 2014-04-09 433 /* PIO transfers start from interrupt. */
1b66e94e6b99953 Jonas Jensen 2014-04-09 434 pio_time = wait_for_completion_interruptible_timeout(
1b66e94e6b99953 Jonas Jensen 2014-04-09 435 &host->pio_complete, host->timeout);
1b66e94e6b99953 Jonas Jensen 2014-04-09 436
1b66e94e6b99953 Jonas Jensen 2014-04-09 437 spin_lock_irqsave(&host->lock, flags);
1b66e94e6b99953 Jonas Jensen 2014-04-09 438 }
1b66e94e6b99953 Jonas Jensen 2014-04-09 439
1b66e94e6b99953 Jonas Jensen 2014-04-09 440 if (host->is_removed) {
1b66e94e6b99953 Jonas Jensen 2014-04-09 441 dev_err(mmc_dev(host->mmc), "card removed\n");
1b66e94e6b99953 Jonas Jensen 2014-04-09 442 mrq->cmd->error = -ETIMEDOUT;
1b66e94e6b99953 Jonas Jensen 2014-04-09 443 goto request_done;
1b66e94e6b99953 Jonas Jensen 2014-04-09 444 }
1b66e94e6b99953 Jonas Jensen 2014-04-09 445
1b66e94e6b99953 Jonas Jensen 2014-04-09 446 if (moxart_wait_for_status(host, MASK_DATA, &status)
1b66e94e6b99953 Jonas Jensen 2014-04-09 447 == -ETIMEDOUT) {
1b66e94e6b99953 Jonas Jensen 2014-04-09 448 mrq->cmd->data->error = -ETIMEDOUT;
1b66e94e6b99953 Jonas Jensen 2014-04-09 449 goto request_done;
1b66e94e6b99953 Jonas Jensen 2014-04-09 450 }
1b66e94e6b99953 Jonas Jensen 2014-04-09 451
1b66e94e6b99953 Jonas Jensen 2014-04-09 452 if (status & DATA_CRC_FAIL)
1b66e94e6b99953 Jonas Jensen 2014-04-09 453 mrq->cmd->data->error = -ETIMEDOUT;
1b66e94e6b99953 Jonas Jensen 2014-04-09 454
1b66e94e6b99953 Jonas Jensen 2014-04-09 455 if (mrq->cmd->data->stop)
1b66e94e6b99953 Jonas Jensen 2014-04-09 456 moxart_send_command(host, mrq->cmd->data->stop);
1b66e94e6b99953 Jonas Jensen 2014-04-09 457 }
1b66e94e6b99953 Jonas Jensen 2014-04-09 458
1b66e94e6b99953 Jonas Jensen 2014-04-09 459 request_done:
1b66e94e6b99953 Jonas Jensen 2014-04-09 460 spin_unlock_irqrestore(&host->lock, flags);
1b66e94e6b99953 Jonas Jensen 2014-04-09 461 mmc_request_done(host->mmc, mrq);
1b66e94e6b99953 Jonas Jensen 2014-04-09 462 }
1b66e94e6b99953 Jonas Jensen 2014-04-09 463
:::::: The code at line 260 was first introduced by commit
:::::: 41f469cac2663a41a7b0c84cb94e8f7024385ae4 mmc: moxart: fix wait_for_completion_interruptible_timeout return variable type
:::::: TO: Nicholas Mc Guire <hofrat@...dl.org>
:::::: CC: Ulf Hansson <ulf.hansson@...aro.org>
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
Download attachment ".config.gz" of type "application/gzip" (33963 bytes)
Powered by blists - more mailing lists