Re: [PATCH] UBI: add debugfs file for tracking PEB state

2016-09-19 Thread kbuild test robot
Hi Ben,

[auto build test WARNING on mtd/master]
[also build test WARNING on v4.8-rc7 next-20160919]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]
[Suggest to use git(>=2.9.0) format-patch --base= (or --base=auto for 
convenience) to record what (public, well-known) commit your patch series was 
built on]
[Check https://git-scm.com/docs/git-format-patch for more information]

url:
https://github.com/0day-ci/linux/commits/Zach-Brown/UBI-add-debugfs-file-for-tracking-PEB-state/20160920-025147
base:   git://git.infradead.org/linux-mtd.git master
config: x86_64-randconfig-i0-201638 (attached as .config)
compiler: gcc-4.9 (Debian 4.9.4-2) 4.9.4
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64 

All warnings (new ones prefixed by >>):

   drivers/mtd/ubi/debug.c: In function 'eraseblk_count_open':
>> drivers/mtd/ubi/debug.c:515:30: warning: cast from pointer to integer of 
>> different size [-Wpointer-to-int-cast]
 s->private = ubi_get_device((int)inode->i_private);
 ^

vim +515 drivers/mtd/ubi/debug.c

   499  .start = eraseblk_count_seq_start,
   500  .next = eraseblk_count_seq_next,
   501  .stop = eraseblk_count_seq_stop,
   502  .show = eraseblk_count_seq_show
   503  };
   504  
   505  static int eraseblk_count_open(struct inode *inode, struct file *f)
   506  {
   507  struct seq_file *s;
   508  int err;
   509  
   510  err = seq_open(f, _count_seq_ops);
   511  if (err)
   512  return err;
   513  
   514  s = f->private_data;
 > 515  s->private = ubi_get_device((int)inode->i_private);
   516  
   517  if (!s->private)
   518  return -ENODEV;
   519  else
   520  return 0;
   521  }
   522  
   523  static int eraseblk_count_release(struct inode *inode, struct file *f)

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


.config.gz
Description: application/gzip


Re: [PATCH] UBI: add debugfs file for tracking PEB state

2016-09-19 Thread kbuild test robot
Hi Ben,

[auto build test WARNING on mtd/master]
[also build test WARNING on v4.8-rc7 next-20160919]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]
[Suggest to use git(>=2.9.0) format-patch --base= (or --base=auto for 
convenience) to record what (public, well-known) commit your patch series was 
built on]
[Check https://git-scm.com/docs/git-format-patch for more information]

url:
https://github.com/0day-ci/linux/commits/Zach-Brown/UBI-add-debugfs-file-for-tracking-PEB-state/20160920-025147
base:   git://git.infradead.org/linux-mtd.git master
config: x86_64-randconfig-i0-201638 (attached as .config)
compiler: gcc-4.9 (Debian 4.9.4-2) 4.9.4
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64 

All warnings (new ones prefixed by >>):

   drivers/mtd/ubi/debug.c: In function 'eraseblk_count_open':
>> drivers/mtd/ubi/debug.c:515:30: warning: cast from pointer to integer of 
>> different size [-Wpointer-to-int-cast]
 s->private = ubi_get_device((int)inode->i_private);
 ^

vim +515 drivers/mtd/ubi/debug.c

   499  .start = eraseblk_count_seq_start,
   500  .next = eraseblk_count_seq_next,
   501  .stop = eraseblk_count_seq_stop,
   502  .show = eraseblk_count_seq_show
   503  };
   504  
   505  static int eraseblk_count_open(struct inode *inode, struct file *f)
   506  {
   507  struct seq_file *s;
   508  int err;
   509  
   510  err = seq_open(f, _count_seq_ops);
   511  if (err)
   512  return err;
   513  
   514  s = f->private_data;
 > 515  s->private = ubi_get_device((int)inode->i_private);
   516  
   517  if (!s->private)
   518  return -ENODEV;
   519  else
   520  return 0;
   521  }
   522  
   523  static int eraseblk_count_release(struct inode *inode, struct file *f)

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


.config.gz
Description: application/gzip


Re: [PATCH] UBI: add debugfs file for tracking PEB state

2016-09-19 Thread Richard Weinberger
Zach,

On 19.09.2016 20:47, Zach Brown wrote:
> + } else {
> + struct ubi_ec_hdr erase_count_header;
> +
> + err = ubi_io_read_ec_hdr(ubi, *block_number,
> +  _count_header, 0);
> + if (err && err != UBI_IO_BITFLIPS)
> + r_sts = READ_STATUS_ERR_READING_ERASE_COUNT;
> + else {
> + erase_count = be64_to_cpu(erase_count_header.ec);
> + if (erase_count > UBI_MAX_ERASECOUNTER)
> + b_sts = BLOCK_STATUS_ERASE_COUNT_BEYOND_MAX;

Hmm, why don't you use ubi->lookuptbl[] to get a ubi_wl_entry object, it knows
the erase counter. That way you don't have to read from the flash. If you read
you have to deal with all kind of read errors, including bitflips.

Thanks,
//richard


Re: [PATCH] UBI: add debugfs file for tracking PEB state

2016-09-19 Thread Richard Weinberger
Zach,

On 19.09.2016 20:47, Zach Brown wrote:
> + } else {
> + struct ubi_ec_hdr erase_count_header;
> +
> + err = ubi_io_read_ec_hdr(ubi, *block_number,
> +  _count_header, 0);
> + if (err && err != UBI_IO_BITFLIPS)
> + r_sts = READ_STATUS_ERR_READING_ERASE_COUNT;
> + else {
> + erase_count = be64_to_cpu(erase_count_header.ec);
> + if (erase_count > UBI_MAX_ERASECOUNTER)
> + b_sts = BLOCK_STATUS_ERASE_COUNT_BEYOND_MAX;

Hmm, why don't you use ubi->lookuptbl[] to get a ubi_wl_entry object, it knows
the erase counter. That way you don't have to read from the flash. If you read
you have to deal with all kind of read errors, including bitflips.

Thanks,
//richard