tree:
https://github.com/bvanassche/linux scsi-status
head: e3e8aaedcd689d1a2ae20024ed467d127bbe060a
commit: e3e8aaedcd689d1a2ae20024ed467d127bbe060a [15/15] Use struct scsi_status more
widely
config: powerpc-randconfig-r005-20210409 (attached as .config)
compiler: clang version 13.0.0 (
https://github.com/llvm/llvm-project
dd453a1389b6a7e6d9214b449d3c54981b1a89b6)
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
# install powerpc cross compiling tool for clang build
# apt-get install binutils-powerpc-linux-gnu
#
https://github.com/bvanassche/linux/commit/e3e8aaedcd689d1a2ae20024ed467d...
git remote add bvanassche
https://github.com/bvanassche/linux
git fetch --no-tags bvanassche scsi-status
git checkout e3e8aaedcd689d1a2ae20024ed467d127bbe060a
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=powerpc
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
All errors (new ones prefixed by >>):
> drivers/scsi/virtio_scsi.c:358:14: error: member reference base
type 'int' is not a structure or union
} else if
(host_byte(result) == DID_BAD_TARGET) {
^~~~~~~~~~~~~~~~~
include/scsi/scsi.h:137:38: note: expanded from macro 'host_byte'
#define host_byte(result) ((result).b.host)
~~~~~~~~^~
1 error generated.
vim +/int +358 drivers/scsi/virtio_scsi.c
865b58c05b8419 Paolo Bonzini 2012-10-02 333
5ff843721467b4 Matt Lupfer 2019-09-05 334 static void
virtscsi_rescan_hotunplug(struct virtio_scsi *vscsi)
5ff843721467b4 Matt Lupfer 2019-09-05 335 {
5ff843721467b4 Matt Lupfer 2019-09-05 336 struct scsi_device *sdev;
5ff843721467b4 Matt Lupfer 2019-09-05 337 struct Scsi_Host *shost =
virtio_scsi_host(vscsi->vdev);
5ff843721467b4 Matt Lupfer 2019-09-05 338 unsigned char scsi_cmd[MAX_COMMAND_SIZE];
5ff843721467b4 Matt Lupfer 2019-09-05 339 int result, inquiry_len, inq_result_len =
256;
5ff843721467b4 Matt Lupfer 2019-09-05 340 char *inq_result = kmalloc(inq_result_len,
GFP_KERNEL);
5ff843721467b4 Matt Lupfer 2019-09-05 341
5ff843721467b4 Matt Lupfer 2019-09-05 342 shost_for_each_device(sdev, shost) {
5ff843721467b4 Matt Lupfer 2019-09-05 343 inquiry_len = sdev->inquiry_len ?
sdev->inquiry_len : 36;
5ff843721467b4 Matt Lupfer 2019-09-05 344
5ff843721467b4 Matt Lupfer 2019-09-05 345 memset(scsi_cmd, 0, sizeof(scsi_cmd));
5ff843721467b4 Matt Lupfer 2019-09-05 346 scsi_cmd[0] = INQUIRY;
5ff843721467b4 Matt Lupfer 2019-09-05 347 scsi_cmd[4] = (unsigned char)
inquiry_len;
5ff843721467b4 Matt Lupfer 2019-09-05 348
5ff843721467b4 Matt Lupfer 2019-09-05 349 memset(inq_result, 0, inq_result_len);
5ff843721467b4 Matt Lupfer 2019-09-05 350
5ff843721467b4 Matt Lupfer 2019-09-05 351 result = scsi_execute_req(sdev, scsi_cmd,
DMA_FROM_DEVICE,
5ff843721467b4 Matt Lupfer 2019-09-05 352 inq_result, inquiry_len, NULL,
5ff843721467b4 Matt Lupfer 2019-09-05 353 SD_TIMEOUT, SD_MAX_RETRIES, NULL);
5ff843721467b4 Matt Lupfer 2019-09-05 354
5ff843721467b4 Matt Lupfer 2019-09-05 355 if (result == 0 && inq_result[0]
>> 5) {
5ff843721467b4 Matt Lupfer 2019-09-05 356 /* PQ indicates the LUN is not attached
*/
5ff843721467b4 Matt Lupfer 2019-09-05 357 scsi_remove_device(sdev);
bb2e3314687630 Maxim Levitsky 2020-07-29 @358 } else if (host_byte(result) ==
DID_BAD_TARGET) {
bb2e3314687630 Maxim Levitsky 2020-07-29 359 /*
bb2e3314687630 Maxim Levitsky 2020-07-29 360 * If all LUNs of a virtio-scsi device
are unplugged
bb2e3314687630 Maxim Levitsky 2020-07-29 361 * it will respond with BAD TARGET on
any INQUIRY
bb2e3314687630 Maxim Levitsky 2020-07-29 362 * command.
bb2e3314687630 Maxim Levitsky 2020-07-29 363 * Remove the device in this case as
well.
bb2e3314687630 Maxim Levitsky 2020-07-29 364 */
bb2e3314687630 Maxim Levitsky 2020-07-29 365 scsi_remove_device(sdev);
5ff843721467b4 Matt Lupfer 2019-09-05 366 }
5ff843721467b4 Matt Lupfer 2019-09-05 367 }
5ff843721467b4 Matt Lupfer 2019-09-05 368
5ff843721467b4 Matt Lupfer 2019-09-05 369 kfree(inq_result);
5ff843721467b4 Matt Lupfer 2019-09-05 370 }
5ff843721467b4 Matt Lupfer 2019-09-05 371
:::::: The code at line 358 was first introduced by commit
:::::: bb2e33146876306d5623080e008f61e96e407590 scsi: virtio-scsi: Correctly handle the
case where all LUNs are unplugged
:::::: TO: Maxim Levitsky <mlevitsk(a)redhat.com>
:::::: CC: Martin K. Petersen <martin.petersen(a)oracle.com>
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org