lkml.org 
[lkml]   [2017]   [Oct]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] nullb: make config_item_type const
Hi Bhumika,

[auto build test WARNING on linus/master]
[also build test WARNING on v4.14-rc4 next-20171013]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url: https://github.com/0day-ci/linux/commits/Bhumika-Goyal/nullb-make-config_item_type-const/20171015-060539
config: x86_64-randconfig-x001-201742 (attached as .config)
compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64

All warnings (new ones prefixed by >>):

drivers/block/null_blk.c: In function 'nullb_group_make_item':
>> drivers/block/null_blk.c:494:47: warning: passing argument 3 of 'config_item_init_type_name' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
config_item_init_type_name(&dev->item, name, &nullb_device_type);
^
In file included from drivers/block/null_blk.c:16:0:
include/linux/configfs.h:73:13: note: expected 'struct config_item_type *' but argument is of type 'const struct config_item_type *'
extern void config_item_init_type_name(struct config_item *item,
^~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/block/null_blk.c: At top level:
>> drivers/block/null_blk.c:541:15: warning: initialization discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
.ci_type = &nullb_group_type,
^
Cyclomatic Complexity 5 include/linux/compiler.h:__read_once_size
Cyclomatic Complexity 5 include/linux/compiler.h:__write_once_size
Cyclomatic Complexity 2 arch/x86/include/asm/bitops.h:set_bit
Cyclomatic Complexity 1 arch/x86/include/asm/bitops.h:__set_bit
Cyclomatic Complexity 2 arch/x86/include/asm/bitops.h:clear_bit
Cyclomatic Complexity 1 arch/x86/include/asm/bitops.h:clear_bit_unlock
Cyclomatic Complexity 1 arch/x86/include/asm/bitops.h:__clear_bit
Cyclomatic Complexity 1 arch/x86/include/asm/bitops.h:test_and_set_bit
Cyclomatic Complexity 1 arch/x86/include/asm/bitops.h:test_and_set_bit_lock
Cyclomatic Complexity 1 arch/x86/include/asm/bitops.h:test_and_clear_bit
Cyclomatic Complexity 1 arch/x86/include/asm/bitops.h:constant_test_bit
Cyclomatic Complexity 1 arch/x86/include/asm/bitops.h:variable_test_bit
Cyclomatic Complexity 1 arch/x86/include/asm/bitops.h:fls64
Cyclomatic Complexity 1 include/linux/log2.h:__ilog2_u64
Cyclomatic Complexity 1 include/linux/list.h:INIT_LIST_HEAD
Cyclomatic Complexity 1 include/linux/list.h:__list_del
Cyclomatic Complexity 1 include/linux/list.h:list_empty
Cyclomatic Complexity 1 arch/x86/include/asm/current.h:get_current
Cyclomatic Complexity 1 include/asm-generic/getorder.h:__get_order
Cyclomatic Complexity 3 include/linux/string.h:strncpy
Cyclomatic Complexity 3 include/linux/string.h:memset
Cyclomatic Complexity 4 include/linux/string.h:memcpy
Cyclomatic Complexity 1 arch/x86/include/asm/atomic64_64.h:atomic64_read
Cyclomatic Complexity 1 arch/x86/include/asm/atomic64_64.h:atomic64_set
Cyclomatic Complexity 1 arch/x86/include/asm/atomic64_64.h:atomic64_add_return
Cyclomatic Complexity 1 arch/x86/include/asm/atomic64_64.h:atomic64_sub_return
Cyclomatic Complexity 1 include/asm-generic/atomic-long.h:atomic_long_read
Cyclomatic Complexity 1 include/asm-generic/atomic-long.h:atomic_long_set
Cyclomatic Complexity 1 include/asm-generic/atomic-long.h:atomic_long_sub_return
Cyclomatic Complexity 1 include/linux/err.h:ERR_PTR
Cyclomatic Complexity 5 arch/x86/include/asm/preempt.h:__preempt_count_add
Cyclomatic Complexity 5 arch/x86/include/asm/preempt.h:__preempt_count_sub
Cyclomatic Complexity 1 include/linux/spinlock.h:spinlock_check
Cyclomatic Complexity 1 include/linux/spinlock.h:spin_lock_irq
Cyclomatic Complexity 1 include/linux/spinlock.h:spin_unlock_irq
Cyclomatic Complexity 1 include/linux/spinlock.h:spin_unlock_irqrestore
Cyclomatic Complexity 1 include/linux/wait.h:waitqueue_active
Cyclomatic Complexity 1 arch/x86/include/asm/topology.h:numa_node_id
Cyclomatic Complexity 1 include/linux/topology.h:numa_mem_id
Cyclomatic Complexity 1 include/linux/radix-tree.h:radix_tree_empty
Cyclomatic Complexity 1 include/linux/radix-tree.h:radix_tree_preload_end
Cyclomatic Complexity 1 include/linux/hrtimer.h:hrtimer_get_expires
Cyclomatic Complexity 1 include/linux/hrtimer.h:hrtimer_get_softexpires
Cyclomatic Complexity 28 include/linux/slab.h:kmalloc_index
Cyclomatic Complexity 1 include/linux/slab.h:__kmalloc_node
Cyclomatic Complexity 1 include/linux/slab.h:kmem_cache_alloc_node_trace
Cyclomatic Complexity 68 include/linux/slab.h:kmalloc_large
Cyclomatic Complexity 5 include/linux/slab.h:kmalloc
Cyclomatic Complexity 5 include/linux/slab.h:kmalloc_node
Cyclomatic Complexity 1 include/linux/slab.h:kzalloc
Cyclomatic Complexity 1 include/linux/slab.h:kzalloc_node
Cyclomatic Complexity 1 include/linux/genhd.h:set_capacity
Cyclomatic Complexity 1 include/linux/mm.h:lowmem_page_address
Cyclomatic Complexity 1 include/linux/uaccess.h:pagefault_disabled_inc
Cyclomatic Complexity 1 include/linux/uaccess.h:pagefault_disabled_dec
Cyclomatic Complexity 1 include/linux/uaccess.h:pagefault_disable
Cyclomatic Complexity 1 include/linux/uaccess.h:pagefault_enable
Cyclomatic Complexity 1 include/linux/highmem.h:kmap_atomic
Cyclomatic Complexity 1 include/linux/highmem.h:__kunmap_atomic
Cyclomatic Complexity 1 include/linux/blk_types.h:op_is_write
Cyclomatic Complexity 4 include/linux/bio.h:bio_no_advance_iter
Cyclomatic Complexity 1 include/linux/blkdev.h:queue_flag_set_unlocked
Cyclomatic Complexity 1 include/linux/blkdev.h:queue_flag_clear_unlocked
Cyclomatic Complexity 1 include/linux/blkdev.h:blk_rq_pos
Cyclomatic Complexity 1 include/linux/blkdev.h:blk_rq_bytes
Cyclomatic Complexity 1 include/linux/blkdev.h:blk_rq_sectors
Cyclomatic Complexity 1 include/linux/blk-mq.h:blk_mq_rq_to_pdu
Cyclomatic Complexity 1 drivers/block/null_blk.c:mb_per_tick
Cyclomatic Complexity 1 drivers/block/null_blk.c:null_cache_active
Cyclomatic Complexity 2 drivers/block/null_blk.c:nullb_to_queue
Cyclomatic Complexity 1 drivers/block/null_blk.c:null_nvm_unregister
Cyclomatic Complexity 1 drivers/block/null_blk.c:null_open
Cyclomatic Complexity 1 drivers/block/null_blk.c:null_release
Cyclomatic Complexity 2 drivers/block/null_blk.c:setup_queues
Cyclomatic Complexity 12 drivers/block/null_blk.c:null_validate_conf
Cyclomatic Complexity 4 drivers/block/null_blk.c:null_param_store_val
Cyclomatic Complexity 1 drivers/block/null_blk.c:null_set_queue_mode
Cyclomatic Complexity 1 drivers/block/null_blk.c:null_set_irqmode
Cyclomatic Complexity 1 drivers/block/null_blk.c:memb_group_features_show
Cyclomatic Complexity 1 include/linux/kernel.h:kstrtoul
Cyclomatic Complexity 2 drivers/block/null_blk.c:nullb_device_ulong_attr_store
Cyclomatic Complexity 4 drivers/block/null_blk.c:setup_commands
Cyclomatic Complexity 1 drivers/block/null_blk.c:cleanup_queue
Cyclomatic Complexity 2 drivers/block/null_blk.c:cleanup_queues
Cyclomatic Complexity 1 drivers/block/null_blk.c:null_free_dev
Cyclomatic Complexity 3 drivers/block/null_blk.c:to_nullb_device
Cyclomatic Complexity 2 drivers/block/null_blk.c:nullb_device_cache_size_store
Cyclomatic Complexity 2 drivers/block/null_blk.c:nullb_device_completion_nsec_store
Cyclomatic Complexity 2 drivers/block/null_blk.c:nullb_device_size_store
Cyclomatic Complexity 1 include/linux/string.h:strstrip
Cyclomatic Complexity 9 drivers/block/null_blk.c:nullb_device_badblocks_store
Cyclomatic Complexity 1 drivers/block/null_blk.c:nullb_device_badblocks_show
Cyclomatic Complexity 1 drivers/block/null_blk.c:nullb_device_ulong_attr_show
Cyclomatic Complexity 1 drivers/block/null_blk.c:nullb_device_cache_size_show
Cyclomatic Complexity 1 drivers/block/null_blk.c:nullb_device_completion_nsec_show
Cyclomatic Complexity 1 drivers/block/null_blk.c:nullb_device_size_show
Cyclomatic Complexity 1 drivers/block/null_blk.c:nullb_device_uint_attr_show
Cyclomatic Complexity 1 drivers/block/null_blk.c:nullb_device_mbps_show

vim +494 drivers/block/null_blk.c

3bf2bd207 Shaohua Li 2017-08-14 484
3bf2bd207 Shaohua Li 2017-08-14 485 static struct
3bf2bd207 Shaohua Li 2017-08-14 486 config_item *nullb_group_make_item(struct config_group *group, const char *name)
3bf2bd207 Shaohua Li 2017-08-14 487 {
3bf2bd207 Shaohua Li 2017-08-14 488 struct nullb_device *dev;
3bf2bd207 Shaohua Li 2017-08-14 489
3bf2bd207 Shaohua Li 2017-08-14 490 dev = null_alloc_dev();
3bf2bd207 Shaohua Li 2017-08-14 491 if (!dev)
3bf2bd207 Shaohua Li 2017-08-14 492 return ERR_PTR(-ENOMEM);
3bf2bd207 Shaohua Li 2017-08-14 493
3bf2bd207 Shaohua Li 2017-08-14 @494 config_item_init_type_name(&dev->item, name, &nullb_device_type);
3bf2bd207 Shaohua Li 2017-08-14 495
3bf2bd207 Shaohua Li 2017-08-14 496 return &dev->item;
3bf2bd207 Shaohua Li 2017-08-14 497 }
3bf2bd207 Shaohua Li 2017-08-14 498
3bf2bd207 Shaohua Li 2017-08-14 499 static void
3bf2bd207 Shaohua Li 2017-08-14 500 nullb_group_drop_item(struct config_group *group, struct config_item *item)
3bf2bd207 Shaohua Li 2017-08-14 501 {
cedcafad8 Shaohua Li 2017-08-14 502 struct nullb_device *dev = to_nullb_device(item);
cedcafad8 Shaohua Li 2017-08-14 503
cedcafad8 Shaohua Li 2017-08-14 504 if (test_and_clear_bit(NULLB_DEV_FL_UP, &dev->flags)) {
cedcafad8 Shaohua Li 2017-08-14 505 mutex_lock(&lock);
cedcafad8 Shaohua Li 2017-08-14 506 dev->power = false;
cedcafad8 Shaohua Li 2017-08-14 507 null_del_dev(dev->nullb);
cedcafad8 Shaohua Li 2017-08-14 508 mutex_unlock(&lock);
cedcafad8 Shaohua Li 2017-08-14 509 }
cedcafad8 Shaohua Li 2017-08-14 510
3bf2bd207 Shaohua Li 2017-08-14 511 config_item_put(item);
3bf2bd207 Shaohua Li 2017-08-14 512 }
3bf2bd207 Shaohua Li 2017-08-14 513
3bf2bd207 Shaohua Li 2017-08-14 514 static ssize_t memb_group_features_show(struct config_item *item, char *page)
3bf2bd207 Shaohua Li 2017-08-14 515 {
2f54a613c Shaohua Li 2017-08-14 516 return snprintf(page, PAGE_SIZE, "memory_backed,discard,bandwidth,cache,badblocks\n");
3bf2bd207 Shaohua Li 2017-08-14 517 }
3bf2bd207 Shaohua Li 2017-08-14 518
3bf2bd207 Shaohua Li 2017-08-14 519 CONFIGFS_ATTR_RO(memb_group_, features);
3bf2bd207 Shaohua Li 2017-08-14 520
3bf2bd207 Shaohua Li 2017-08-14 521 static struct configfs_attribute *nullb_group_attrs[] = {
3bf2bd207 Shaohua Li 2017-08-14 522 &memb_group_attr_features,
3bf2bd207 Shaohua Li 2017-08-14 523 NULL,
3bf2bd207 Shaohua Li 2017-08-14 524 };
3bf2bd207 Shaohua Li 2017-08-14 525
3bf2bd207 Shaohua Li 2017-08-14 526 static struct configfs_group_operations nullb_group_ops = {
3bf2bd207 Shaohua Li 2017-08-14 527 .make_item = nullb_group_make_item,
3bf2bd207 Shaohua Li 2017-08-14 528 .drop_item = nullb_group_drop_item,
3bf2bd207 Shaohua Li 2017-08-14 529 };
3bf2bd207 Shaohua Li 2017-08-14 530
d2358d8dd Bhumika Goyal 2017-10-12 531 static const struct config_item_type nullb_group_type = {
3bf2bd207 Shaohua Li 2017-08-14 532 .ct_group_ops = &nullb_group_ops,
3bf2bd207 Shaohua Li 2017-08-14 533 .ct_attrs = nullb_group_attrs,
3bf2bd207 Shaohua Li 2017-08-14 534 .ct_owner = THIS_MODULE,
3bf2bd207 Shaohua Li 2017-08-14 535 };
3bf2bd207 Shaohua Li 2017-08-14 536
3bf2bd207 Shaohua Li 2017-08-14 537 static struct configfs_subsystem nullb_subsys = {
3bf2bd207 Shaohua Li 2017-08-14 538 .su_group = {
3bf2bd207 Shaohua Li 2017-08-14 539 .cg_item = {
3bf2bd207 Shaohua Li 2017-08-14 540 .ci_namebuf = "nullb",
3bf2bd207 Shaohua Li 2017-08-14 @541 .ci_type = &nullb_group_type,
3bf2bd207 Shaohua Li 2017-08-14 542 },
3bf2bd207 Shaohua Li 2017-08-14 543 },
3bf2bd207 Shaohua Li 2017-08-14 544 };
3bf2bd207 Shaohua Li 2017-08-14 545

:::::: The code at line 494 was first introduced by commit
:::::: 3bf2bd20734e3e6ffda53719a9c10fb3ee9c5ffa nullb: add configfs interface

:::::: TO: Shaohua Li <shli@fb.com>
:::::: CC: Jens Axboe <axboe@kernel.dk>

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
[unhandled content-type:application/gzip]
\
 
 \ /
  Last update: 2017-10-15 01:22    [W:0.076 / U:2.412 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site