Hi Christian, Thank you for the patch! Perhaps something to improve: [auto build test WARNING on staging/staging-testing] [also build test WARNING on usb/usb-testing linus/master v5.7-rc5 next-20200514] [cannot apply to balbi-usb/next peter.chen-usb/ci-for-usb-next] [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/Christian-Gromm/staging-most-move-USB-adapter-driver-to-stable-branch/20200514-183525 base: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git 8a01032e02c8a0fb3e9f33791023b62dee73cc03 config: x86_64-allyesconfig (attached as .config) compiler: clang version 11.0.0 (https://github.com/llvm/llvm-project a52f10b5a382c040e7ad1ce933cda6c07a4b3a8d) reproduce: wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # install x86_64 cross compiling tool for clang build # apt-get install binutils-x86-64-linux-gnu # save the attached .config to linux build tree COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64 If you fix the issue, kindly add following tag as appropriate Reported-by: kbuild test robot <lkp@xxxxxxxxx> All warnings (new ones prefixed by >>, old ones prefixed by <<): >> drivers/most/most_usb.c:1104:6: warning: variable 'ret' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized] if (!mdev->busy_urbs) ^~~~~~~~~~~~~~~~ drivers/most/most_usb.c:1186:9: note: uninitialized use occurs here return ret; ^~~ drivers/most/most_usb.c:1104:2: note: remove the 'if' if its condition is always false if (!mdev->busy_urbs) ^~~~~~~~~~~~~~~~~~~~~ drivers/most/most_usb.c:1099:6: warning: variable 'ret' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized] if (!mdev->ep_address) ^~~~~~~~~~~~~~~~~ drivers/most/most_usb.c:1186:9: note: uninitialized use occurs here return ret; ^~~ drivers/most/most_usb.c:1099:2: note: remove the 'if' if its condition is always false if (!mdev->ep_address) ^~~~~~~~~~~~~~~~~~~~~~ drivers/most/most_usb.c:1093:6: warning: variable 'ret' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized] if (!mdev->cap) ^~~~~~~~~~ drivers/most/most_usb.c:1186:9: note: uninitialized use occurs here return ret; ^~~ drivers/most/most_usb.c:1093:2: note: remove the 'if' if its condition is always false if (!mdev->cap) ^~~~~~~~~~~~~~~ drivers/most/most_usb.c:1089:6: warning: variable 'ret' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized] if (!mdev->conf) ^~~~~~~~~~~ drivers/most/most_usb.c:1186:9: note: uninitialized use occurs here return ret; ^~~ drivers/most/most_usb.c:1089:2: note: remove the 'if' if its condition is always false if (!mdev->conf) ^~~~~~~~~~~~~~~~ drivers/most/most_usb.c:1047:9: note: initialize the variable 'ret' to silence this warning int ret; ^ = 0 4 warnings generated. vim +1104 drivers/most/most_usb.c 56c7d34c835125c6 Christian Gromm 2020-05-14 1017 56c7d34c835125c6 Christian Gromm 2020-05-14 1018 static void release_mdev(struct device *dev) 56c7d34c835125c6 Christian Gromm 2020-05-14 1019 { 56c7d34c835125c6 Christian Gromm 2020-05-14 1020 struct most_dev *mdev = to_mdev_from_dev(dev); 56c7d34c835125c6 Christian Gromm 2020-05-14 1021 56c7d34c835125c6 Christian Gromm 2020-05-14 1022 kfree(mdev); 56c7d34c835125c6 Christian Gromm 2020-05-14 1023 } 56c7d34c835125c6 Christian Gromm 2020-05-14 1024 /** 56c7d34c835125c6 Christian Gromm 2020-05-14 1025 * hdm_probe - probe function of USB device driver 56c7d34c835125c6 Christian Gromm 2020-05-14 1026 * @interface: Interface of the attached USB device 56c7d34c835125c6 Christian Gromm 2020-05-14 1027 * @id: Pointer to the USB ID table. 56c7d34c835125c6 Christian Gromm 2020-05-14 1028 * 56c7d34c835125c6 Christian Gromm 2020-05-14 1029 * This allocates and initializes the device instance, adds the new 56c7d34c835125c6 Christian Gromm 2020-05-14 1030 * entry to the internal list, scans the USB descriptors and registers 56c7d34c835125c6 Christian Gromm 2020-05-14 1031 * the interface with the core. 56c7d34c835125c6 Christian Gromm 2020-05-14 1032 * Additionally, the DCI objects are created and the hardware is sync'd. 56c7d34c835125c6 Christian Gromm 2020-05-14 1033 * 56c7d34c835125c6 Christian Gromm 2020-05-14 1034 * Return 0 on success. In case of an error a negative number is returned. 56c7d34c835125c6 Christian Gromm 2020-05-14 1035 */ 56c7d34c835125c6 Christian Gromm 2020-05-14 1036 static int 56c7d34c835125c6 Christian Gromm 2020-05-14 1037 hdm_probe(struct usb_interface *interface, const struct usb_device_id *id) 56c7d34c835125c6 Christian Gromm 2020-05-14 1038 { 56c7d34c835125c6 Christian Gromm 2020-05-14 1039 struct usb_host_interface *usb_iface_desc = interface->cur_altsetting; 56c7d34c835125c6 Christian Gromm 2020-05-14 1040 struct usb_device *usb_dev = interface_to_usbdev(interface); 56c7d34c835125c6 Christian Gromm 2020-05-14 1041 struct device *dev = &usb_dev->dev; 56c7d34c835125c6 Christian Gromm 2020-05-14 1042 struct most_dev *mdev = kzalloc(sizeof(*mdev), GFP_KERNEL); 56c7d34c835125c6 Christian Gromm 2020-05-14 1043 unsigned int i; 56c7d34c835125c6 Christian Gromm 2020-05-14 1044 unsigned int num_endpoints; 56c7d34c835125c6 Christian Gromm 2020-05-14 1045 struct most_channel_capability *tmp_cap; 56c7d34c835125c6 Christian Gromm 2020-05-14 1046 struct usb_endpoint_descriptor *ep_desc; 220484e072685b00 Christian Gromm 2020-05-14 1047 int ret; 56c7d34c835125c6 Christian Gromm 2020-05-14 1048 56c7d34c835125c6 Christian Gromm 2020-05-14 1049 if (!mdev) 220484e072685b00 Christian Gromm 2020-05-14 1050 return -ENOMEM; 56c7d34c835125c6 Christian Gromm 2020-05-14 1051 56c7d34c835125c6 Christian Gromm 2020-05-14 1052 usb_set_intfdata(interface, mdev); 56c7d34c835125c6 Christian Gromm 2020-05-14 1053 num_endpoints = usb_iface_desc->desc.bNumEndpoints; 220484e072685b00 Christian Gromm 2020-05-14 1054 if (num_endpoints > MAX_NUM_ENDPOINTS) { 220484e072685b00 Christian Gromm 2020-05-14 1055 kfree(mdev); 220484e072685b00 Christian Gromm 2020-05-14 1056 return -EINVAL; 220484e072685b00 Christian Gromm 2020-05-14 1057 } 56c7d34c835125c6 Christian Gromm 2020-05-14 1058 mutex_init(&mdev->io_mutex); 56c7d34c835125c6 Christian Gromm 2020-05-14 1059 INIT_WORK(&mdev->poll_work_obj, wq_netinfo); 56c7d34c835125c6 Christian Gromm 2020-05-14 1060 timer_setup(&mdev->link_stat_timer, link_stat_timer_handler, 0); 56c7d34c835125c6 Christian Gromm 2020-05-14 1061 56c7d34c835125c6 Christian Gromm 2020-05-14 1062 mdev->usb_device = usb_dev; 56c7d34c835125c6 Christian Gromm 2020-05-14 1063 mdev->link_stat_timer.expires = jiffies + (2 * HZ); 56c7d34c835125c6 Christian Gromm 2020-05-14 1064 56c7d34c835125c6 Christian Gromm 2020-05-14 1065 mdev->iface.mod = hdm_usb_fops.owner; 56c7d34c835125c6 Christian Gromm 2020-05-14 1066 mdev->iface.dev = &mdev->dev; 56c7d34c835125c6 Christian Gromm 2020-05-14 1067 mdev->iface.driver_dev = &interface->dev; 56c7d34c835125c6 Christian Gromm 2020-05-14 1068 mdev->iface.interface = ITYPE_USB; 56c7d34c835125c6 Christian Gromm 2020-05-14 1069 mdev->iface.configure = hdm_configure_channel; 56c7d34c835125c6 Christian Gromm 2020-05-14 1070 mdev->iface.request_netinfo = hdm_request_netinfo; 56c7d34c835125c6 Christian Gromm 2020-05-14 1071 mdev->iface.enqueue = hdm_enqueue; 56c7d34c835125c6 Christian Gromm 2020-05-14 1072 mdev->iface.poison_channel = hdm_poison_channel; 56c7d34c835125c6 Christian Gromm 2020-05-14 1073 mdev->iface.dma_alloc = hdm_dma_alloc; 56c7d34c835125c6 Christian Gromm 2020-05-14 1074 mdev->iface.dma_free = hdm_dma_free; 56c7d34c835125c6 Christian Gromm 2020-05-14 1075 mdev->iface.description = mdev->description; 56c7d34c835125c6 Christian Gromm 2020-05-14 1076 mdev->iface.num_channels = num_endpoints; 56c7d34c835125c6 Christian Gromm 2020-05-14 1077 56c7d34c835125c6 Christian Gromm 2020-05-14 1078 snprintf(mdev->description, sizeof(mdev->description), 56c7d34c835125c6 Christian Gromm 2020-05-14 1079 "%d-%s:%d.%d", 56c7d34c835125c6 Christian Gromm 2020-05-14 1080 usb_dev->bus->busnum, 56c7d34c835125c6 Christian Gromm 2020-05-14 1081 usb_dev->devpath, 56c7d34c835125c6 Christian Gromm 2020-05-14 1082 usb_dev->config->desc.bConfigurationValue, 56c7d34c835125c6 Christian Gromm 2020-05-14 1083 usb_iface_desc->desc.bInterfaceNumber); 56c7d34c835125c6 Christian Gromm 2020-05-14 1084 56c7d34c835125c6 Christian Gromm 2020-05-14 1085 mdev->dev.init_name = mdev->description; 56c7d34c835125c6 Christian Gromm 2020-05-14 1086 mdev->dev.parent = &interface->dev; 56c7d34c835125c6 Christian Gromm 2020-05-14 1087 mdev->dev.release = release_mdev; 56c7d34c835125c6 Christian Gromm 2020-05-14 1088 mdev->conf = kcalloc(num_endpoints, sizeof(*mdev->conf), GFP_KERNEL); 56c7d34c835125c6 Christian Gromm 2020-05-14 1089 if (!mdev->conf) 56c7d34c835125c6 Christian Gromm 2020-05-14 1090 goto err_free_mdev; 56c7d34c835125c6 Christian Gromm 2020-05-14 1091 56c7d34c835125c6 Christian Gromm 2020-05-14 1092 mdev->cap = kcalloc(num_endpoints, sizeof(*mdev->cap), GFP_KERNEL); 56c7d34c835125c6 Christian Gromm 2020-05-14 1093 if (!mdev->cap) 56c7d34c835125c6 Christian Gromm 2020-05-14 1094 goto err_free_conf; 56c7d34c835125c6 Christian Gromm 2020-05-14 1095 56c7d34c835125c6 Christian Gromm 2020-05-14 1096 mdev->iface.channel_vector = mdev->cap; 56c7d34c835125c6 Christian Gromm 2020-05-14 1097 mdev->ep_address = 56c7d34c835125c6 Christian Gromm 2020-05-14 1098 kcalloc(num_endpoints, sizeof(*mdev->ep_address), GFP_KERNEL); 56c7d34c835125c6 Christian Gromm 2020-05-14 1099 if (!mdev->ep_address) 56c7d34c835125c6 Christian Gromm 2020-05-14 1100 goto err_free_cap; 56c7d34c835125c6 Christian Gromm 2020-05-14 1101 56c7d34c835125c6 Christian Gromm 2020-05-14 1102 mdev->busy_urbs = 56c7d34c835125c6 Christian Gromm 2020-05-14 1103 kcalloc(num_endpoints, sizeof(*mdev->busy_urbs), GFP_KERNEL); 56c7d34c835125c6 Christian Gromm 2020-05-14 @1104 if (!mdev->busy_urbs) 56c7d34c835125c6 Christian Gromm 2020-05-14 1105 goto err_free_ep_address; 56c7d34c835125c6 Christian Gromm 2020-05-14 1106 56c7d34c835125c6 Christian Gromm 2020-05-14 1107 tmp_cap = mdev->cap; 56c7d34c835125c6 Christian Gromm 2020-05-14 1108 for (i = 0; i < num_endpoints; i++) { 56c7d34c835125c6 Christian Gromm 2020-05-14 1109 ep_desc = &usb_iface_desc->endpoint[i].desc; 56c7d34c835125c6 Christian Gromm 2020-05-14 1110 mdev->ep_address[i] = ep_desc->bEndpointAddress; 56c7d34c835125c6 Christian Gromm 2020-05-14 1111 mdev->padding_active[i] = false; 56c7d34c835125c6 Christian Gromm 2020-05-14 1112 mdev->is_channel_healthy[i] = true; 56c7d34c835125c6 Christian Gromm 2020-05-14 1113 56c7d34c835125c6 Christian Gromm 2020-05-14 1114 snprintf(&mdev->suffix[i][0], MAX_SUFFIX_LEN, "ep%02x", 56c7d34c835125c6 Christian Gromm 2020-05-14 1115 mdev->ep_address[i]); 56c7d34c835125c6 Christian Gromm 2020-05-14 1116 56c7d34c835125c6 Christian Gromm 2020-05-14 1117 tmp_cap->name_suffix = &mdev->suffix[i][0]; 56c7d34c835125c6 Christian Gromm 2020-05-14 1118 tmp_cap->buffer_size_packet = MAX_BUF_SIZE; 56c7d34c835125c6 Christian Gromm 2020-05-14 1119 tmp_cap->buffer_size_streaming = MAX_BUF_SIZE; 56c7d34c835125c6 Christian Gromm 2020-05-14 1120 tmp_cap->num_buffers_packet = BUF_CHAIN_SIZE; 56c7d34c835125c6 Christian Gromm 2020-05-14 1121 tmp_cap->num_buffers_streaming = BUF_CHAIN_SIZE; 56c7d34c835125c6 Christian Gromm 2020-05-14 1122 tmp_cap->data_type = MOST_CH_CONTROL | MOST_CH_ASYNC | 56c7d34c835125c6 Christian Gromm 2020-05-14 1123 MOST_CH_ISOC | MOST_CH_SYNC; 56c7d34c835125c6 Christian Gromm 2020-05-14 1124 if (usb_endpoint_dir_in(ep_desc)) 56c7d34c835125c6 Christian Gromm 2020-05-14 1125 tmp_cap->direction = MOST_CH_RX; 56c7d34c835125c6 Christian Gromm 2020-05-14 1126 else 56c7d34c835125c6 Christian Gromm 2020-05-14 1127 tmp_cap->direction = MOST_CH_TX; 56c7d34c835125c6 Christian Gromm 2020-05-14 1128 tmp_cap++; 56c7d34c835125c6 Christian Gromm 2020-05-14 1129 init_usb_anchor(&mdev->busy_urbs[i]); 56c7d34c835125c6 Christian Gromm 2020-05-14 1130 spin_lock_init(&mdev->channel_lock[i]); 56c7d34c835125c6 Christian Gromm 2020-05-14 1131 } 56c7d34c835125c6 Christian Gromm 2020-05-14 1132 dev_notice(dev, "claimed gadget: Vendor=%4.4x ProdID=%4.4x Bus=%02x Device=%02x\n", 56c7d34c835125c6 Christian Gromm 2020-05-14 1133 le16_to_cpu(usb_dev->descriptor.idVendor), 56c7d34c835125c6 Christian Gromm 2020-05-14 1134 le16_to_cpu(usb_dev->descriptor.idProduct), 56c7d34c835125c6 Christian Gromm 2020-05-14 1135 usb_dev->bus->busnum, 56c7d34c835125c6 Christian Gromm 2020-05-14 1136 usb_dev->devnum); 56c7d34c835125c6 Christian Gromm 2020-05-14 1137 56c7d34c835125c6 Christian Gromm 2020-05-14 1138 dev_notice(dev, "device path: /sys/bus/usb/devices/%d-%s:%d.%d\n", 56c7d34c835125c6 Christian Gromm 2020-05-14 1139 usb_dev->bus->busnum, 56c7d34c835125c6 Christian Gromm 2020-05-14 1140 usb_dev->devpath, 56c7d34c835125c6 Christian Gromm 2020-05-14 1141 usb_dev->config->desc.bConfigurationValue, 56c7d34c835125c6 Christian Gromm 2020-05-14 1142 usb_iface_desc->desc.bInterfaceNumber); 56c7d34c835125c6 Christian Gromm 2020-05-14 1143 56c7d34c835125c6 Christian Gromm 2020-05-14 1144 ret = most_register_interface(&mdev->iface); 56c7d34c835125c6 Christian Gromm 2020-05-14 1145 if (ret) 56c7d34c835125c6 Christian Gromm 2020-05-14 1146 goto err_free_busy_urbs; 56c7d34c835125c6 Christian Gromm 2020-05-14 1147 56c7d34c835125c6 Christian Gromm 2020-05-14 1148 mutex_lock(&mdev->io_mutex); 56c7d34c835125c6 Christian Gromm 2020-05-14 1149 if (le16_to_cpu(usb_dev->descriptor.idProduct) == USB_DEV_ID_OS81118 || 56c7d34c835125c6 Christian Gromm 2020-05-14 1150 le16_to_cpu(usb_dev->descriptor.idProduct) == USB_DEV_ID_OS81119 || 56c7d34c835125c6 Christian Gromm 2020-05-14 1151 le16_to_cpu(usb_dev->descriptor.idProduct) == USB_DEV_ID_OS81210) { 56c7d34c835125c6 Christian Gromm 2020-05-14 1152 mdev->dci = kzalloc(sizeof(*mdev->dci), GFP_KERNEL); 56c7d34c835125c6 Christian Gromm 2020-05-14 1153 if (!mdev->dci) { 56c7d34c835125c6 Christian Gromm 2020-05-14 1154 mutex_unlock(&mdev->io_mutex); 56c7d34c835125c6 Christian Gromm 2020-05-14 1155 most_deregister_interface(&mdev->iface); 56c7d34c835125c6 Christian Gromm 2020-05-14 1156 ret = -ENOMEM; 56c7d34c835125c6 Christian Gromm 2020-05-14 1157 goto err_free_busy_urbs; 56c7d34c835125c6 Christian Gromm 2020-05-14 1158 } 56c7d34c835125c6 Christian Gromm 2020-05-14 1159 56c7d34c835125c6 Christian Gromm 2020-05-14 1160 mdev->dci->dev.init_name = "dci"; 56c7d34c835125c6 Christian Gromm 2020-05-14 1161 mdev->dci->dev.parent = get_device(mdev->iface.dev); 56c7d34c835125c6 Christian Gromm 2020-05-14 1162 mdev->dci->dev.groups = dci_attr_groups; 56c7d34c835125c6 Christian Gromm 2020-05-14 1163 mdev->dci->dev.release = release_dci; 56c7d34c835125c6 Christian Gromm 2020-05-14 1164 if (device_register(&mdev->dci->dev)) { 56c7d34c835125c6 Christian Gromm 2020-05-14 1165 mutex_unlock(&mdev->io_mutex); 56c7d34c835125c6 Christian Gromm 2020-05-14 1166 most_deregister_interface(&mdev->iface); 56c7d34c835125c6 Christian Gromm 2020-05-14 1167 ret = -ENOMEM; 56c7d34c835125c6 Christian Gromm 2020-05-14 1168 goto err_free_dci; 56c7d34c835125c6 Christian Gromm 2020-05-14 1169 } 56c7d34c835125c6 Christian Gromm 2020-05-14 1170 mdev->dci->usb_device = mdev->usb_device; 56c7d34c835125c6 Christian Gromm 2020-05-14 1171 } 56c7d34c835125c6 Christian Gromm 2020-05-14 1172 mutex_unlock(&mdev->io_mutex); 56c7d34c835125c6 Christian Gromm 2020-05-14 1173 return 0; 56c7d34c835125c6 Christian Gromm 2020-05-14 1174 err_free_dci: 56c7d34c835125c6 Christian Gromm 2020-05-14 1175 put_device(&mdev->dci->dev); 56c7d34c835125c6 Christian Gromm 2020-05-14 1176 err_free_busy_urbs: 56c7d34c835125c6 Christian Gromm 2020-05-14 1177 kfree(mdev->busy_urbs); 56c7d34c835125c6 Christian Gromm 2020-05-14 1178 err_free_ep_address: 56c7d34c835125c6 Christian Gromm 2020-05-14 1179 kfree(mdev->ep_address); 56c7d34c835125c6 Christian Gromm 2020-05-14 1180 err_free_cap: 56c7d34c835125c6 Christian Gromm 2020-05-14 1181 kfree(mdev->cap); 56c7d34c835125c6 Christian Gromm 2020-05-14 1182 err_free_conf: 56c7d34c835125c6 Christian Gromm 2020-05-14 1183 kfree(mdev->conf); 56c7d34c835125c6 Christian Gromm 2020-05-14 1184 err_free_mdev: 56c7d34c835125c6 Christian Gromm 2020-05-14 1185 put_device(&mdev->dev); 56c7d34c835125c6 Christian Gromm 2020-05-14 1186 return ret; 56c7d34c835125c6 Christian Gromm 2020-05-14 1187 } 56c7d34c835125c6 Christian Gromm 2020-05-14 1188 :::::: The code at line 1104 was first introduced by commit :::::: 56c7d34c835125c6587fb28f67cddd1d4062975f drivers: most: add usb adapter driver :::::: TO: Christian Gromm <christian.gromm@xxxxxxxxxxxxx> :::::: CC: 0day robot <lkp@xxxxxxxxx> --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx
Attachment:
.config.gz
Description: application/gzip