Hi Anders, Thank you for the patch! Perhaps something to improve: [auto build test WARNING on linus/master] [also build test WARNING on v4.17-rc5 next-20180511] [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/Anders-Roxell/memstick-mspro_block-fix-unused-variable-warning/20180514-185634 config: x86_64-randconfig-x017-201819 (attached as .config) compiler: gcc-7 (Debian 7.3.0-16) 7.3.0 reproduce: # save the attached .config to linux build tree make ARCH=x86_64 All warnings (new ones prefixed by >>): In file included from arch/x86/include/asm/current.h:5:0, from include/linux/sched.h:12, from include/linux/blkdev.h:5, from drivers/memstick/core/mspro_block.c:15: drivers/memstick/core/mspro_block.c: In function 'mspro_block_init_disk': drivers/memstick/core/mspro_block.c:1180:6: error: 'host' undeclared (first use in this function); did you mean 'halt'? if (host->dev.dma_mask && *(host->dev.dma_mask)) ^ include/linux/compiler.h:58:30: note: in definition of macro '__trace_if' if (__builtin_constant_p(!!(cond)) ? !!(cond) : \ ^~~~ >> drivers/memstick/core/mspro_block.c:1180:2: note: in expansion of macro 'if' if (host->dev.dma_mask && *(host->dev.dma_mask)) ^~ drivers/memstick/core/mspro_block.c:1180:6: note: each undeclared identifier is reported only once for each function it appears in if (host->dev.dma_mask && *(host->dev.dma_mask)) ^ include/linux/compiler.h:58:30: note: in definition of macro '__trace_if' if (__builtin_constant_p(!!(cond)) ? !!(cond) : \ ^~~~ >> drivers/memstick/core/mspro_block.c:1180:2: note: in expansion of macro 'if' if (host->dev.dma_mask && *(host->dev.dma_mask)) ^~ vim +/if +1180 drivers/memstick/core/mspro_block.c baf8532a1 Alex Dubov 2008-02-09 1169 baf8532a1 Alex Dubov 2008-02-09 1170 static int mspro_block_init_disk(struct memstick_dev *card) baf8532a1 Alex Dubov 2008-02-09 1171 { baf8532a1 Alex Dubov 2008-02-09 1172 struct mspro_block_data *msb = memstick_get_drvdata(card); baf8532a1 Alex Dubov 2008-02-09 1173 struct mspro_devinfo *dev_info = NULL; baf8532a1 Alex Dubov 2008-02-09 1174 struct mspro_sys_info *sys_info = NULL; baf8532a1 Alex Dubov 2008-02-09 1175 struct mspro_sys_attr *s_attr = NULL; baf8532a1 Alex Dubov 2008-02-09 1176 int rc, disk_id; baf8532a1 Alex Dubov 2008-02-09 1177 u64 limit = BLK_BOUNCE_HIGH; baf8532a1 Alex Dubov 2008-02-09 1178 unsigned long capacity; baf8532a1 Alex Dubov 2008-02-09 1179 c4c66cf17 Greg Kroah-Hartman 2008-03-04 @1180 if (host->dev.dma_mask && *(host->dev.dma_mask)) c4c66cf17 Greg Kroah-Hartman 2008-03-04 1181 limit = *(host->dev.dma_mask); baf8532a1 Alex Dubov 2008-02-09 1182 baf8532a1 Alex Dubov 2008-02-09 1183 for (rc = 0; msb->attr_group.attrs[rc]; ++rc) { baf8532a1 Alex Dubov 2008-02-09 1184 s_attr = mspro_from_sysfs_attr(msb->attr_group.attrs[rc]); baf8532a1 Alex Dubov 2008-02-09 1185 baf8532a1 Alex Dubov 2008-02-09 1186 if (s_attr->id == MSPRO_BLOCK_ID_DEVINFO) baf8532a1 Alex Dubov 2008-02-09 1187 dev_info = s_attr->data; baf8532a1 Alex Dubov 2008-02-09 1188 else if (s_attr->id == MSPRO_BLOCK_ID_SYSINFO) baf8532a1 Alex Dubov 2008-02-09 1189 sys_info = s_attr->data; baf8532a1 Alex Dubov 2008-02-09 1190 } baf8532a1 Alex Dubov 2008-02-09 1191 baf8532a1 Alex Dubov 2008-02-09 1192 if (!dev_info || !sys_info) baf8532a1 Alex Dubov 2008-02-09 1193 return -ENODEV; baf8532a1 Alex Dubov 2008-02-09 1194 baf8532a1 Alex Dubov 2008-02-09 1195 msb->cylinders = be16_to_cpu(dev_info->cylinders); baf8532a1 Alex Dubov 2008-02-09 1196 msb->heads = be16_to_cpu(dev_info->heads); baf8532a1 Alex Dubov 2008-02-09 1197 msb->sectors_per_track = be16_to_cpu(dev_info->sectors_per_track); baf8532a1 Alex Dubov 2008-02-09 1198 baf8532a1 Alex Dubov 2008-02-09 1199 msb->page_size = be16_to_cpu(sys_info->unit_size); baf8532a1 Alex Dubov 2008-02-09 1200 d8256d487 Alex Dubov 2011-01-12 1201 mutex_lock(&mspro_block_disk_lock); 7b51f4783 Tejun Heo 2013-02-27 1202 disk_id = idr_alloc(&mspro_block_disk_idr, card, 0, 256, GFP_KERNEL); d8256d487 Alex Dubov 2011-01-12 1203 mutex_unlock(&mspro_block_disk_lock); 7b51f4783 Tejun Heo 2013-02-27 1204 if (disk_id < 0) 7b51f4783 Tejun Heo 2013-02-27 1205 return disk_id; baf8532a1 Alex Dubov 2008-02-09 1206 8e82f8c34 Alex Dubov 2008-09-13 1207 msb->disk = alloc_disk(1 << MSPRO_BLOCK_PART_SHIFT); baf8532a1 Alex Dubov 2008-02-09 1208 if (!msb->disk) { baf8532a1 Alex Dubov 2008-02-09 1209 rc = -ENOMEM; baf8532a1 Alex Dubov 2008-02-09 1210 goto out_release_id; baf8532a1 Alex Dubov 2008-02-09 1211 } baf8532a1 Alex Dubov 2008-02-09 1212 f1d826980 Alex Dubov 2008-07-25 1213 msb->queue = blk_init_queue(mspro_block_submit_req, &msb->q_lock); baf8532a1 Alex Dubov 2008-02-09 1214 if (!msb->queue) { baf8532a1 Alex Dubov 2008-02-09 1215 rc = -ENOMEM; baf8532a1 Alex Dubov 2008-02-09 1216 goto out_put_disk; baf8532a1 Alex Dubov 2008-02-09 1217 } baf8532a1 Alex Dubov 2008-02-09 1218 baf8532a1 Alex Dubov 2008-02-09 1219 msb->queue->queuedata = card; baf8532a1 Alex Dubov 2008-02-09 1220 baf8532a1 Alex Dubov 2008-02-09 1221 blk_queue_bounce_limit(msb->queue, limit); 086fa5ff0 Martin K. Petersen 2010-02-26 1222 blk_queue_max_hw_sectors(msb->queue, MSPRO_BLOCK_MAX_PAGES); 8a78362c4 Martin K. Petersen 2010-02-26 1223 blk_queue_max_segments(msb->queue, MSPRO_BLOCK_MAX_SEGS); baf8532a1 Alex Dubov 2008-02-09 1224 blk_queue_max_segment_size(msb->queue, baf8532a1 Alex Dubov 2008-02-09 1225 MSPRO_BLOCK_MAX_PAGES * msb->page_size); baf8532a1 Alex Dubov 2008-02-09 1226 baf8532a1 Alex Dubov 2008-02-09 1227 msb->disk->major = major; 8e82f8c34 Alex Dubov 2008-09-13 1228 msb->disk->first_minor = disk_id << MSPRO_BLOCK_PART_SHIFT; baf8532a1 Alex Dubov 2008-02-09 1229 msb->disk->fops = &ms_block_bdops; baf8532a1 Alex Dubov 2008-02-09 1230 msb->usage_count = 1; baf8532a1 Alex Dubov 2008-02-09 1231 msb->disk->private_data = msb; baf8532a1 Alex Dubov 2008-02-09 1232 msb->disk->queue = msb->queue; baf8532a1 Alex Dubov 2008-02-09 1233 baf8532a1 Alex Dubov 2008-02-09 1234 sprintf(msb->disk->disk_name, "mspblk%d", disk_id); baf8532a1 Alex Dubov 2008-02-09 1235 e1defc4ff Martin K. Petersen 2009-05-22 1236 blk_queue_logical_block_size(msb->queue, msb->page_size); baf8532a1 Alex Dubov 2008-02-09 1237 baf8532a1 Alex Dubov 2008-02-09 1238 capacity = be16_to_cpu(sys_info->user_block_count); baf8532a1 Alex Dubov 2008-02-09 1239 capacity *= be16_to_cpu(sys_info->block_size); baf8532a1 Alex Dubov 2008-02-09 1240 capacity *= msb->page_size >> 9; baf8532a1 Alex Dubov 2008-02-09 1241 set_capacity(msb->disk, capacity); baf8532a1 Alex Dubov 2008-02-09 1242 dev_dbg(&card->dev, "capacity set %ld\n", capacity); baf8532a1 Alex Dubov 2008-02-09 1243 0d52c756a Dan Williams 2016-06-15 1244 device_add_disk(&card->dev, msb->disk); baf8532a1 Alex Dubov 2008-02-09 1245 msb->active = 1; baf8532a1 Alex Dubov 2008-02-09 1246 return 0; baf8532a1 Alex Dubov 2008-02-09 1247 baf8532a1 Alex Dubov 2008-02-09 1248 out_put_disk: baf8532a1 Alex Dubov 2008-02-09 1249 put_disk(msb->disk); baf8532a1 Alex Dubov 2008-02-09 1250 out_release_id: baf8532a1 Alex Dubov 2008-02-09 1251 mutex_lock(&mspro_block_disk_lock); baf8532a1 Alex Dubov 2008-02-09 1252 idr_remove(&mspro_block_disk_idr, disk_id); baf8532a1 Alex Dubov 2008-02-09 1253 mutex_unlock(&mspro_block_disk_lock); baf8532a1 Alex Dubov 2008-02-09 1254 return rc; baf8532a1 Alex Dubov 2008-02-09 1255 } baf8532a1 Alex Dubov 2008-02-09 1256 :::::: The code at line 1180 was first introduced by commit :::::: c4c66cf1787d408066fbfc69209185701f5df15f memstick: convert struct class_device to struct device :::::: TO: Greg Kroah-Hartman :::::: CC: Greg Kroah-Hartman --- 0-DAY kernel test infrastructure Open Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation