Re: [PATCH] gpiolib: split character device into gpiolib-cdev

kbuild test robot
2020-05-28T04:58:21Z

[-- Attachment #1: Type: text/plain, Size: 4187 bytes --]

Hi Kent,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on v5.7-rc5]
[cannot apply to gpio/for-next linus/master linux/master v5.7-rc7 v5.7-rc6 next-20200526]
[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/Kent-Gibson/gpiolib-split-character-device-into-gpiolib-cdev/20200528-000035
base: 2ef96a5bb12be62ef75b5828c0aab838ebb29cb8
config: riscv-allyesconfig (attached as .config)
compiler: riscv64-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
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=riscv

If you fix the issue, kindly add following tag as appropriate
Reported-by: kbuild test robot <lkp@intel.com>

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

drivers/gpio/gpiolib-cdev.c:1092:5: warning: no previous prototype for 'gpiolib_cdev_register' [-Wmissing-prototypes]
1092 | int gpiolib_cdev_register(struct gpio_device *gdev, dev_t devt)
| ^~~~~~~~~~~~~~~~~~~~~
drivers/gpio/gpiolib-cdev.c:1110:6: warning: no previous prototype for 'gpiolib_cdev_unregister' [-Wmissing-prototypes]
1110 | void gpiolib_cdev_unregister(struct gpio_device *gdev)
| ^~~~~~~~~~~~~~~~~~~~~~~
drivers/gpio/gpiolib-cdev.c: In function 'gpio_desc_to_lineinfo':
>> drivers/gpio/gpiolib-cdev.c:779:3: warning: 'strncpy' specified bound 32 equals destination size [-Wstringop-truncation]
779 | strncpy(info->name, desc->name, sizeof(info->name));
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

vim +/strncpy +779 drivers/gpio/gpiolib-cdev.c

769
770 static void gpio_desc_to_lineinfo(struct gpio_desc *desc,
771 struct gpioline_info *info)
772 {
773 struct gpio_chip *gc = desc->gdev->chip;
774 unsigned long flags;
775
776 spin_lock_irqsave(&gpio_lock, flags);
777
778 if (desc->name) {
> 779 strncpy(info->name, desc->name, sizeof(info->name));
780 info->name[sizeof(info->name) - 1] = '\0';
781 } else {
782 info->name[0] = '\0';
783 }
784
785 if (desc->label) {
786 strncpy(info->consumer, desc->label, sizeof(info->consumer));
787 info->consumer[sizeof(info->consumer) - 1] = '\0';
788 } else {
789 info->consumer[0] = '\0';
790 }
791
792 /*
793 * Userspace only need to know that the kernel is using this GPIO so
794 * it can't use it.
795 */
796 info->flags = 0;
797 if (test_bit(FLAG_REQUESTED, &desc->flags) ||
798 test_bit(FLAG_IS_HOGGED, &desc->flags) ||
799 test_bit(FLAG_USED_AS_IRQ, &desc->flags) ||
800 test_bit(FLAG_EXPORT, &desc->flags) ||
801 test_bit(FLAG_SYSFS, &desc->flags) ||
802 !pinctrl_gpio_can_use_line(gc->base + info->line_offset))
803 info->flags |= GPIOLINE_FLAG_KERNEL;
804 if (test_bit(FLAG_IS_OUT, &desc->flags))
805 info->flags |= GPIOLINE_FLAG_IS_OUT;
806 if (test_bit(FLAG_ACTIVE_LOW, &desc->flags))
807 info->flags |= GPIOLINE_FLAG_ACTIVE_LOW;
808 if (test_bit(FLAG_OPEN_DRAIN, &desc->flags))
809 info->flags |= (GPIOLINE_FLAG_OPEN_DRAIN |
810 GPIOLINE_FLAG_IS_OUT);
811 if (test_bit(FLAG_OPEN_SOURCE, &desc->flags))
812 info->flags |= (GPIOLINE_FLAG_OPEN_SOURCE |
813 GPIOLINE_FLAG_IS_OUT);
814 if (test_bit(FLAG_BIAS_DISABLE, &desc->flags))
815 info->flags |= GPIOLINE_FLAG_BIAS_DISABLE;
816 if (test_bit(FLAG_PULL_DOWN, &desc->flags))
817 info->flags |= GPIOLINE_FLAG_BIAS_PULL_DOWN;
818 if (test_bit(FLAG_PULL_UP, &desc->flags))
819 info->flags |= GPIOLINE_FLAG_BIAS_PULL_UP;
820
821 spin_unlock_irqrestore(&gpio_lock, flags);
822 }
823

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 63412 bytes --]