Re: [PATCH 1/6] USB: gadget: f_hid: move chardev setup to module init

From: kbuild test robot
Date: Sun Oct 27 2019 - 13:14:10 EST


Hi John,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on balbi-usb/next]
[also build test ERROR on v5.4-rc4 next-20191025]
[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/John-Keeping/USB-gadget-f_hid-fix-lifetime-issues/20191028-001924
base: https://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb.git next
config: sparc64-allmodconfig (attached as .config)
compiler: sparc64-linux-gcc (GCC) 7.4.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
GCC_VERSION=7.4.0 make.cross ARCH=sparc64

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@xxxxxxxxx>

All error/warnings (new ones prefixed by >>):

In file included from drivers/usb/gadget/function/f_hid.c:9:0:
include/linux/module.h:131:42: error: redefinition of '__inittest'
static inline initcall_t __maybe_unused __inittest(void) \
^
>> drivers/usb/gadget/function/f_hid.c:1156:1: note: in expansion of macro 'module_init'
module_init(ghid_setup);
^~~~~~~~~~~
include/linux/module.h:131:42: note: previous definition of '__inittest' was here
static inline initcall_t __maybe_unused __inittest(void) \
^
>> include/linux/usb/composite.h:627:2: note: in expansion of macro 'module_init'
module_init(_name ## mod_init); \
^~~~~~~~~~~
>> drivers/usb/gadget/function/f_hid.c:1116:1: note: in expansion of macro 'DECLARE_USB_FUNCTION_INIT'
DECLARE_USB_FUNCTION_INIT(hid, hidg_alloc_inst, hidg_alloc);
^~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/module.h:133:6: error: redefinition of 'init_module'
int init_module(void) __copy(initfn) __attribute__((alias(#initfn)));
^
>> drivers/usb/gadget/function/f_hid.c:1156:1: note: in expansion of macro 'module_init'
module_init(ghid_setup);
^~~~~~~~~~~
include/linux/module.h:133:6: note: previous definition of 'init_module' was here
int init_module(void) __copy(initfn) __attribute__((alias(#initfn)));
^
>> include/linux/usb/composite.h:627:2: note: in expansion of macro 'module_init'
module_init(_name ## mod_init); \
^~~~~~~~~~~
>> drivers/usb/gadget/function/f_hid.c:1116:1: note: in expansion of macro 'DECLARE_USB_FUNCTION_INIT'
DECLARE_USB_FUNCTION_INIT(hid, hidg_alloc_inst, hidg_alloc);
^~~~~~~~~~~~~~~~~~~~~~~~~
>> include/linux/module.h:137:42: error: redefinition of '__exittest'
static inline exitcall_t __maybe_unused __exittest(void) \
^
>> drivers/usb/gadget/function/f_hid.c:1157:1: note: in expansion of macro 'module_exit'
module_exit(ghid_cleanup);
^~~~~~~~~~~
include/linux/module.h:137:42: note: previous definition of '__exittest' was here
static inline exitcall_t __maybe_unused __exittest(void) \
^
>> include/linux/usb/composite.h:628:2: note: in expansion of macro 'module_exit'
module_exit(_name ## mod_exit)
^~~~~~~~~~~
>> drivers/usb/gadget/function/f_hid.c:1116:1: note: in expansion of macro 'DECLARE_USB_FUNCTION_INIT'
DECLARE_USB_FUNCTION_INIT(hid, hidg_alloc_inst, hidg_alloc);
^~~~~~~~~~~~~~~~~~~~~~~~~
>> include/linux/module.h:139:7: error: redefinition of 'cleanup_module'
void cleanup_module(void) __copy(exitfn) __attribute__((alias(#exitfn)));
^
>> drivers/usb/gadget/function/f_hid.c:1157:1: note: in expansion of macro 'module_exit'
module_exit(ghid_cleanup);
^~~~~~~~~~~
include/linux/module.h:139:7: note: previous definition of 'cleanup_module' was here
void cleanup_module(void) __copy(exitfn) __attribute__((alias(#exitfn)));
^
>> include/linux/usb/composite.h:628:2: note: in expansion of macro 'module_exit'
module_exit(_name ## mod_exit)
^~~~~~~~~~~
>> drivers/usb/gadget/function/f_hid.c:1116:1: note: in expansion of macro 'DECLARE_USB_FUNCTION_INIT'
DECLARE_USB_FUNCTION_INIT(hid, hidg_alloc_inst, hidg_alloc);
^~~~~~~~~~~~~~~~~~~~~~~~~
--
In file included from drivers/usb//gadget/function/f_hid.c:9:0:
include/linux/module.h:131:42: error: redefinition of '__inittest'
static inline initcall_t __maybe_unused __inittest(void) \
^
drivers/usb//gadget/function/f_hid.c:1156:1: note: in expansion of macro 'module_init'
module_init(ghid_setup);
^~~~~~~~~~~
include/linux/module.h:131:42: note: previous definition of '__inittest' was here
static inline initcall_t __maybe_unused __inittest(void) \
^
>> include/linux/usb/composite.h:627:2: note: in expansion of macro 'module_init'
module_init(_name ## mod_init); \
^~~~~~~~~~~
drivers/usb//gadget/function/f_hid.c:1116:1: note: in expansion of macro 'DECLARE_USB_FUNCTION_INIT'
DECLARE_USB_FUNCTION_INIT(hid, hidg_alloc_inst, hidg_alloc);
^~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/module.h:133:6: error: redefinition of 'init_module'
int init_module(void) __copy(initfn) __attribute__((alias(#initfn)));
^
drivers/usb//gadget/function/f_hid.c:1156:1: note: in expansion of macro 'module_init'
module_init(ghid_setup);
^~~~~~~~~~~
include/linux/module.h:133:6: note: previous definition of 'init_module' was here
int init_module(void) __copy(initfn) __attribute__((alias(#initfn)));
^
>> include/linux/usb/composite.h:627:2: note: in expansion of macro 'module_init'
module_init(_name ## mod_init); \
^~~~~~~~~~~
drivers/usb//gadget/function/f_hid.c:1116:1: note: in expansion of macro 'DECLARE_USB_FUNCTION_INIT'
DECLARE_USB_FUNCTION_INIT(hid, hidg_alloc_inst, hidg_alloc);
^~~~~~~~~~~~~~~~~~~~~~~~~
>> include/linux/module.h:137:42: error: redefinition of '__exittest'
static inline exitcall_t __maybe_unused __exittest(void) \
^
drivers/usb//gadget/function/f_hid.c:1157:1: note: in expansion of macro 'module_exit'
module_exit(ghid_cleanup);
^~~~~~~~~~~
include/linux/module.h:137:42: note: previous definition of '__exittest' was here
static inline exitcall_t __maybe_unused __exittest(void) \
^
>> include/linux/usb/composite.h:628:2: note: in expansion of macro 'module_exit'
module_exit(_name ## mod_exit)
^~~~~~~~~~~
drivers/usb//gadget/function/f_hid.c:1116:1: note: in expansion of macro 'DECLARE_USB_FUNCTION_INIT'
DECLARE_USB_FUNCTION_INIT(hid, hidg_alloc_inst, hidg_alloc);
^~~~~~~~~~~~~~~~~~~~~~~~~
>> include/linux/module.h:139:7: error: redefinition of 'cleanup_module'
void cleanup_module(void) __copy(exitfn) __attribute__((alias(#exitfn)));
^
drivers/usb//gadget/function/f_hid.c:1157:1: note: in expansion of macro 'module_exit'
module_exit(ghid_cleanup);
^~~~~~~~~~~
include/linux/module.h:139:7: note: previous definition of 'cleanup_module' was here
void cleanup_module(void) __copy(exitfn) __attribute__((alias(#exitfn)));
^
>> include/linux/usb/composite.h:628:2: note: in expansion of macro 'module_exit'
module_exit(_name ## mod_exit)
^~~~~~~~~~~
drivers/usb//gadget/function/f_hid.c:1116:1: note: in expansion of macro 'DECLARE_USB_FUNCTION_INIT'
DECLARE_USB_FUNCTION_INIT(hid, hidg_alloc_inst, hidg_alloc);
^~~~~~~~~~~~~~~~~~~~~~~~~

vim +/module_init +1156 drivers/usb/gadget/function/f_hid.c

1115
> 1116 DECLARE_USB_FUNCTION_INIT(hid, hidg_alloc_inst, hidg_alloc);
1117 MODULE_LICENSE("GPL");
1118 MODULE_AUTHOR("Fabien Chouteau");
1119
1120 static int ghid_setup(void)
1121 {
1122 int status;
1123 dev_t dev;
1124
1125 hidg_class = class_create(THIS_MODULE, "hidg");
1126 if (IS_ERR(hidg_class)) {
1127 status = PTR_ERR(hidg_class);
1128 hidg_class = NULL;
1129 return status;
1130 }
1131
1132 status = alloc_chrdev_region(&dev, 0, HIDG_MINORS, "hidg");
1133 if (status) {
1134 class_destroy(hidg_class);
1135 hidg_class = NULL;
1136 return status;
1137 }
1138
1139 major = MAJOR(dev);
1140 minors = HIDG_MINORS;
1141
1142 return 0;
1143 }
1144
1145 static void ghid_cleanup(void)
1146 {
1147 if (major) {
1148 unregister_chrdev_region(MKDEV(major, 0), minors);
1149 major = minors = 0;
1150 }
1151
1152 class_destroy(hidg_class);
1153 hidg_class = NULL;
1154 }
1155
> 1156 module_init(ghid_setup);
> 1157 module_exit(ghid_cleanup);

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

Attachment: .config.gz
Description: application/gzip