Hi Bean,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on linus/master]
[also build test WARNING on v5.7-rc6 next-20200519]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url:    
https://github.com/0day-ci/linux/commits/Bean-Huo/Micron-SLC-NAND-filling-block/20200519-205658
base:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 
642b151f45dd54809ea00ecd3976a56c1ec9b53d
config: microblaze-randconfig-r024-20200519 (attached as .config)
compiler: microblaze-linux-gcc (GCC) 9.3.0
reproduce:
        wget 
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O 
~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross 
ARCH=microblaze 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kbuild test robot <[email protected]>

All warnings (new ones prefixed by >>, old ones prefixed by <<):

In file included from include/linux/bits.h:23,
from include/linux/bitops.h:5,
from include/linux/kernel.h:12,
from include/asm-generic/bug.h:19,
from ./arch/microblaze/include/generated/asm/bug.h:1,
from include/linux/bug.h:5,
from include/linux/mmdebug.h:5,
from include/linux/gfp.h:5,
from include/linux/slab.h:15,
from drivers/mtd/nand/raw/nand_micron.c:9:
drivers/mtd/nand/raw/nand_micron.c: In function 'micron_nand_write_oob':
include/linux/bits.h:26:28: warning: comparison of unsigned expression < 0 is 
always false [-Wtype-limits]
26 |   __builtin_constant_p((l) > (h)), (l) > (h), 0)))
|                            ^
include/linux/build_bug.h:16:62: note: in definition of macro 
'BUILD_BUG_ON_ZERO'
16 | #define BUILD_BUG_ON_ZERO(e) ((int)(sizeof(struct { int:(-!!(e)); })))
|                                                              ^
include/linux/bits.h:39:3: note: in expansion of macro 'GENMASK_INPUT_CHECK'
39 |  (GENMASK_INPUT_CHECK(h, l) + __GENMASK(h, l))
|   ^~~~~~~~~~~~~~~~~~~
drivers/mtd/nand/raw/nand_micron.c:506:32: note: in expansion of macro 'GENMASK'
506 |  micron->writtenp[first_eb] |= GENMASK(first_p + nb_p, 0) &
|                                ^~~~~~~
include/linux/bits.h:26:40: warning: comparison of unsigned expression < 0 is 
always false [-Wtype-limits]
26 |   __builtin_constant_p((l) > (h)), (l) > (h), 0)))
|                                        ^
include/linux/build_bug.h:16:62: note: in definition of macro 
'BUILD_BUG_ON_ZERO'
16 | #define BUILD_BUG_ON_ZERO(e) ((int)(sizeof(struct { int:(-!!(e)); })))
|                                                              ^
include/linux/bits.h:39:3: note: in expansion of macro 'GENMASK_INPUT_CHECK'
39 |  (GENMASK_INPUT_CHECK(h, l) + __GENMASK(h, l))
|   ^~~~~~~~~~~~~~~~~~~
drivers/mtd/nand/raw/nand_micron.c:506:32: note: in expansion of macro 'GENMASK'
506 |  micron->writtenp[first_eb] |= GENMASK(first_p + nb_p, 0) &
|                                ^~~~~~~
include/linux/bits.h:26:28: warning: comparison of unsigned expression < 0 is 
always false [-Wtype-limits]
26 |   __builtin_constant_p((l) > (h)), (l) > (h), 0)))
|                            ^
include/linux/build_bug.h:16:62: note: in definition of macro 
'BUILD_BUG_ON_ZERO'
16 | #define BUILD_BUG_ON_ZERO(e) ((int)(sizeof(struct { int:(-!!(e)); })))
|                                                              ^
include/linux/bits.h:39:3: note: in expansion of macro 'GENMASK_INPUT_CHECK'
39 |  (GENMASK_INPUT_CHECK(h, l) + __GENMASK(h, l))
|   ^~~~~~~~~~~~~~~~~~~
drivers/mtd/nand/raw/nand_micron.c:518:27: note: in expansion of macro 'GENMASK'
518 |   micron->writtenp[eb] |= GENMASK(remaining_p - 1, 0) &
|                           ^~~~~~~
include/linux/bits.h:26:40: warning: comparison of unsigned expression < 0 is 
always false [-Wtype-limits]
26 |   __builtin_constant_p((l) > (h)), (l) > (h), 0)))
|                                        ^
include/linux/build_bug.h:16:62: note: in definition of macro 
'BUILD_BUG_ON_ZERO'
16 | #define BUILD_BUG_ON_ZERO(e) ((int)(sizeof(struct { int:(-!!(e)); })))
|                                                              ^
include/linux/bits.h:39:3: note: in expansion of macro 'GENMASK_INPUT_CHECK'
39 |  (GENMASK_INPUT_CHECK(h, l) + __GENMASK(h, l))
|   ^~~~~~~~~~~~~~~~~~~
drivers/mtd/nand/raw/nand_micron.c:518:27: note: in expansion of macro 'GENMASK'
518 |   micron->writtenp[eb] |= GENMASK(remaining_p - 1, 0) &
|                           ^~~~~~~
In file included from include/asm-generic/bug.h:5,
from ./arch/microblaze/include/generated/asm/bug.h:1,
from include/linux/bug.h:5,
from include/linux/mmdebug.h:5,
from include/linux/gfp.h:5,
from include/linux/slab.h:15,
from drivers/mtd/nand/raw/nand_micron.c:9:
>> include/linux/compiler.h:56:23: warning: this 'if' clause does not guard... 
>> [-Wmisleading-indentation]
56 | #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
|                       ^~
>> drivers/mtd/nand/raw/nand_micron.c:517:2: note: in expansion of macro 'if'
517 |  if (remaining_p)
|  ^~
drivers/mtd/nand/raw/nand_micron.c:520:3: note: ...this statement, but the 
latter is misleadingly indented as if it were guarded by the 'if'
520 |   return 0;
|   ^~~~~~

vim +/if +517 drivers/mtd/nand/raw/nand_micron.c

   484  
   485  static int micron_nand_write_oob(struct nand_chip *chip, loff_t to,
   486                                   struct mtd_oob_ops *ops)
   487  {
   488          struct micron_nand *micron = nand_get_manufacturer_data(chip);
   489          u32 eb_sz = nanddev_eraseblock_size(&chip->base);
   490          u32 p_sz = nanddev_page_size(&chip->base);
   491          u32 ppeb = nanddev_pages_per_eraseblock(&chip->base);
   492          u32 nb_p_tot = ops->len / p_sz;
   493          u32 first_eb = DIV_ROUND_DOWN_ULL(to, eb_sz);
   494          u32 first_p = DIV_ROUND_UP_ULL(to - (first_eb * eb_sz), p_sz);
   495          u32 nb_eb = DIV_ROUND_UP_ULL(first_p + nb_p_tot, ppeb);
   496          u32 remaining_p, eb, nb_p;
   497          int ret;
   498  
   499          ret = nand_write_oob_nand(chip, to, ops);
   500  
   501          if (ret || ops->len != ops->retlen)
   502                  return ret;
   503  
   504          /* Mark the last pages of the first erase block to write */
   505          nb_p = min(nb_p_tot, ppeb - first_p);
   506          micron->writtenp[first_eb] |= GENMASK(first_p + nb_p, 0) &
   507                                          MICRON_PAGE_MASK_TRIGGER;
   508          remaining_p = nb_p_tot - nb_p;
   509  
   510          /* Mark all the pages of all "in-the-middle" erase blocks */
   511          for (eb = first_eb + 1; eb < first_eb + nb_eb - 1; eb++) {
   512                  micron->writtenp[eb] |= MICRON_PAGE_MASK_TRIGGER;
   513                  remaining_p -= ppeb;
   514          }
   515  
   516          /* Mark the first pages of the last erase block to write */
 > 517          if (remaining_p)
   518                  micron->writtenp[eb] |= GENMASK(remaining_p - 1, 0) &
   519                                          MICRON_PAGE_MASK_TRIGGER;
   520                  return 0;
   521  }
   522  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/[email protected]

Attachment: .config.gz
Description: application/gzip

Reply via email to