CC: llvm(a)lists.linux.dev CC: kbuild-all(a)lists.01.org In-Reply-To: <20211029074902.4fayed6mcltifgdz@linutronix.de> References: <20211029074902.4fayed6mcltifgdz@linutronix.de> TO: Sebastian Andrzej Siewior TO: linux-scsi(a)vger.kernel.org TO: Ketan Mukadam CC: "James E.J. Bottomley" CC: "Martin K. Petersen" CC: Thomas Gleixner Hi Sebastian, Thank you for the patch! Perhaps something to improve: [auto build test WARNING on jejb-scsi/for-next] [also build test WARNING on mkp-scsi/for-next v5.15-rc7 next-20211029] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch] url: https://github.com/0day-ci/linux/commits/Sebastian-Andrzej-Siewior/scsi-be2iscsi-Replace-irq_poll-with-threaded-IRQ-handler/20211029-155031 base: https://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi.git for-next :::::: branch date: 3 days ago :::::: commit date: 3 days ago config: i386-randconfig-c001-20211031 (attached as .config) compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project d321548c3ce987f4f21350ba1c81fdb5d4354224) 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 # https://github.com/0day-ci/linux/commit/66895bb3d61cae1257df8eb153ea1a6c9dda075a git remote add linux-review https://github.com/0day-ci/linux git fetch --no-tags linux-review Sebastian-Andrzej-Siewior/scsi-be2iscsi-Replace-irq_poll-with-threaded-IRQ-handler/20211029-155031 git checkout 66895bb3d61cae1257df8eb153ea1a6c9dda075a # save the attached .config to linux build tree COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=i386 clang-analyzer If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot clang-analyzer warnings: (new ones prefixed by >>) drivers/scsi/be2iscsi/be_main.c:3737:2: note: Loop condition is true. Entering loop body for (ulp_num = 0; ulp_num < BEISCSI_ULP_COUNT; ulp_num++) { ^ drivers/scsi/be2iscsi/be_main.c:3738:7: note: Assuming the condition is false if (test_bit(ulp_num, &phba->fw_config.ulp_supported)) { ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/scsi/be2iscsi/be_main.c:3738:3: note: Taking false branch if (test_bit(ulp_num, &phba->fw_config.ulp_supported)) { ^ drivers/scsi/be2iscsi/be_main.c:3737:2: note: Loop condition is true. Entering loop body for (ulp_num = 0; ulp_num < BEISCSI_ULP_COUNT; ulp_num++) { ^ drivers/scsi/be2iscsi/be_main.c:3738:7: note: Assuming the condition is false if (test_bit(ulp_num, &phba->fw_config.ulp_supported)) { ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/scsi/be2iscsi/be_main.c:3738:3: note: Taking false branch if (test_bit(ulp_num, &phba->fw_config.ulp_supported)) { ^ drivers/scsi/be2iscsi/be_main.c:3737:2: note: Loop condition is false. Execution continues on line 3774 for (ulp_num = 0; ulp_num < BEISCSI_ULP_COUNT; ulp_num++) { ^ drivers/scsi/be2iscsi/be_main.c:3775:6: note: 'status' is equal to 0 if (status != 0) { ^~~~~~ drivers/scsi/be2iscsi/be_main.c:3775:2: note: Taking false branch if (status != 0) { ^ drivers/scsi/be2iscsi/be_main.c:3782:6: note: 'status' is equal to 0 if (status != 0) { ^~~~~~ drivers/scsi/be2iscsi/be_main.c:3782:2: note: Taking false branch if (status != 0) { ^ drivers/scsi/be2iscsi/be_main.c:3787:11: note: Calling 'beiscsi_create_wrb_rings' status = beiscsi_create_wrb_rings(phba, phwi_context, phwi_ctrlr); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/scsi/be2iscsi/be_main.c:3363:6: note: Assuming 'pwrb_arr' is non-null if (!pwrb_arr) { ^~~~~~~~~ drivers/scsi/be2iscsi/be_main.c:3363:2: note: Taking false branch if (!pwrb_arr) { ^ drivers/scsi/be2iscsi/be_main.c:3373:16: note: Assuming 'num' is < field 'cxns_per_ctrl' for (num = 0; num < phba->params.cxns_per_ctrl; num++) { ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/scsi/be2iscsi/be_main.c:3373:2: note: Loop condition is true. Entering loop body for (num = 0; num < phba->params.cxns_per_ctrl; num++) { ^ drivers/scsi/be2iscsi/be_main.c:3374:7: note: Assuming 'num_wrb_rings' is 0 if (num_wrb_rings) { ^~~~~~~~~~~~~ drivers/scsi/be2iscsi/be_main.c:3374:3: note: Taking false branch if (num_wrb_rings) { ^ drivers/scsi/be2iscsi/be_main.c:3373:16: note: Assuming 'num' is >= field 'cxns_per_ctrl' for (num = 0; num < phba->params.cxns_per_ctrl; num++) { ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/scsi/be2iscsi/be_main.c:3373:2: note: Loop condition is false. Execution continues on line 3401 for (num = 0; num < phba->params.cxns_per_ctrl; num++) { ^ drivers/scsi/be2iscsi/be_main.c:3401:2: note: Loop condition is true. Entering loop body for (ulp_num = 0; ulp_num < BEISCSI_ULP_COUNT; ulp_num++) ^ drivers/scsi/be2iscsi/be_main.c:3402:7: note: Assuming the condition is false if (test_bit(ulp_num, &phba->fw_config.ulp_supported)) { ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/scsi/be2iscsi/be_main.c:3402:3: note: Taking false branch if (test_bit(ulp_num, &phba->fw_config.ulp_supported)) { ^ drivers/scsi/be2iscsi/be_main.c:3401:2: note: Loop condition is true. Entering loop body for (ulp_num = 0; ulp_num < BEISCSI_ULP_COUNT; ulp_num++) ^ drivers/scsi/be2iscsi/be_main.c:3402:7: note: Assuming the condition is false if (test_bit(ulp_num, &phba->fw_config.ulp_supported)) { ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/scsi/be2iscsi/be_main.c:3402:3: note: Taking false branch if (test_bit(ulp_num, &phba->fw_config.ulp_supported)) { ^ drivers/scsi/be2iscsi/be_main.c:3401:2: note: Loop condition is false. Execution continues on line 3409 for (ulp_num = 0; ulp_num < BEISCSI_ULP_COUNT; ulp_num++) ^ drivers/scsi/be2iscsi/be_main.c:3409:2: note: Loop condition is true. Entering loop body for (i = 0; i < phba->params.cxns_per_ctrl; i++) { ^ drivers/scsi/be2iscsi/be_main.c:3410:7: note: 'ulp_count' is <= 1 if (ulp_count > 1) { ^~~~~~~~~ drivers/scsi/be2iscsi/be_main.c:3410:3: note: Taking false branch if (ulp_count > 1) { ^ drivers/scsi/be2iscsi/be_main.c:3421:3: note: Calling 'hwi_build_be_sgl_by_offset' hwi_build_be_sgl_by_offset(phba, &pwrb_arr[i], &sgl); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/scsi/be2iscsi/be_main.c:2981:6: note: Branch condition evaluates to a garbage value if (sgl->va) ^~~~~~~ drivers/scsi/be2iscsi/be_main.c:4843:3: warning: Value stored to 'rc' is never read [clang-analyzer-deadcode.DeadStores] rc = wait_event_interruptible_timeout( ^ drivers/scsi/be2iscsi/be_main.c:4843:3: note: Value stored to 'rc' is never read >> drivers/scsi/be2iscsi/be_main.c:5392:13: warning: Array subscript is undefined [clang-analyzer-core.uninitialized.ArraySubscript] pbe_eq = &phwi_context->be_eq[i]; ^ drivers/scsi/be2iscsi/be_main.c:5416:9: note: Left side of '&&' is false phba = container_of(work, struct beiscsi_hba, recover_port.work); ^ include/linux/kernel.h:495:61: note: expanded from macro 'container_of' BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \ ^ drivers/scsi/be2iscsi/be_main.c:5416:9: note: Taking false branch phba = container_of(work, struct beiscsi_hba, recover_port.work); ^ include/linux/kernel.h:495:2: note: expanded from macro 'container_of' BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \ ^ include/linux/build_bug.h:39:37: note: expanded from macro 'BUILD_BUG_ON_MSG' #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) ^ include/linux/compiler_types.h:322:2: note: expanded from macro 'compiletime_assert' _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) ^ include/linux/compiler_types.h:310:2: note: expanded from macro '_compiletime_assert' __compiletime_assert(condition, msg, prefix, suffix) ^ include/linux/compiler_types.h:302:3: note: expanded from macro '__compiletime_assert' if (!(condition)) \ ^ drivers/scsi/be2iscsi/be_main.c:5416:9: note: Loop condition is false. Exiting loop phba = container_of(work, struct beiscsi_hba, recover_port.work); ^ include/linux/kernel.h:495:2: note: expanded from macro 'container_of' BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \ ^ include/linux/build_bug.h:39:37: note: expanded from macro 'BUILD_BUG_ON_MSG' #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) ^ include/linux/compiler_types.h:322:2: note: expanded from macro 'compiletime_assert' _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) ^ include/linux/compiler_types.h:310:2: note: expanded from macro '_compiletime_assert' __compiletime_assert(condition, msg, prefix, suffix) ^ include/linux/compiler_types.h:300:2: note: expanded from macro '__compiletime_assert' do { \ ^ drivers/scsi/be2iscsi/be_main.c:5417:2: note: Calling 'beiscsi_disable_port' beiscsi_disable_port(phba, 0); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/scsi/be2iscsi/be_main.c:5377:2: note: 'i' declared without an initial value unsigned int i; ^~~~~~~~~~~~~~ drivers/scsi/be2iscsi/be_main.c:5379:6: note: Assuming the condition is false if (!test_and_clear_bit(BEISCSI_HBA_ONLINE, &phba->state)) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/scsi/be2iscsi/be_main.c:5379:2: note: Taking false branch if (!test_and_clear_bit(BEISCSI_HBA_ONLINE, &phba->state)) ^ drivers/scsi/be2iscsi/be_main.c:5391:7: note: 'unload' is 0 if (!unload && beiscsi_hba_in_error(phba)) { ^~~~~~ drivers/scsi/be2iscsi/be_main.c:5391:6: note: Left side of '&&' is true if (!unload && beiscsi_hba_in_error(phba)) { ^ drivers/scsi/be2iscsi/be_main.c:5391:17: note: Assuming the condition is true if (!unload && beiscsi_hba_in_error(phba)) { ^ drivers/scsi/be2iscsi/be_main.h:395:37: note: expanded from macro 'beiscsi_hba_in_error' #define beiscsi_hba_in_error(phba) ((phba)->state & BEISCSI_HBA_IN_ERR) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/scsi/be2iscsi/be_main.c:5391:2: note: Taking true branch if (!unload && beiscsi_hba_in_error(phba)) { ^ drivers/scsi/be2iscsi/be_main.c:5392:13: note: Array subscript is undefined pbe_eq = &phwi_context->be_eq[i]; ^ ~ Suppressed 5 warnings (4 in non-user code, 1 with check filters). Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well. 5 warnings generated. drivers/gpu/drm/i915/gt/uc/intel_guc_ads.c:160:2: warning: Undefined or garbage value returned to caller [clang-analyzer-core.uninitialized.UndefReturn] return ret; ^ ~~~ drivers/gpu/drm/i915/gt/uc/intel_guc_ads.c:145:2: note: 'ret' declared without an initial value int ret; ^~~~~~~ drivers/gpu/drm/i915/gt/uc/intel_guc_ads.c:147:6: note: Assuming 'blob' is non-null if (!blob) ^~~~~ drivers/gpu/drm/i915/gt/uc/intel_guc_ads.c:147:2: note: Taking false branch if (!blob) ^ drivers/gpu/drm/i915/gt/uc/intel_guc_ads.c:154:7: note: Calling 'intel_guc_is_ready' if (!intel_guc_is_ready(guc)) ^~~~~~~~~~~~~~~~~~~~~~~ drivers/gpu/drm/i915/gt/uc/intel_guc.h:232:9: note: Left side of '&&' is true return intel_guc_is_fw_running(guc) && intel_guc_ct_enabled(&guc->ct); ^ drivers/gpu/drm/i915/gt/uc/intel_guc.h:232:2: note: Returning value, which participates in a condition later return intel_guc_is_fw_running(guc) && intel_guc_ct_enabled(&guc->ct); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/gpu/drm/i915/gt/uc/intel_guc_ads.c:154:7: note: Returning from 'intel_guc_is_ready' if (!intel_guc_is_ready(guc)) vim +5392 drivers/scsi/be2iscsi/be_main.c d1d5ca887c0ee6 Jitendra Bhivare 2016-08-19 5363 d1d5ca887c0ee6 Jitendra Bhivare 2016-08-19 5364 /* d1d5ca887c0ee6 Jitendra Bhivare 2016-08-19 5365 * beiscsi_disable_port()- Disable port and cleanup driver resources. d1d5ca887c0ee6 Jitendra Bhivare 2016-08-19 5366 * This is called in HBA error handling and driver removal. d1d5ca887c0ee6 Jitendra Bhivare 2016-08-19 5367 * @phba: Instance Priv structure d1d5ca887c0ee6 Jitendra Bhivare 2016-08-19 5368 * @unload: indicate driver is unloading d1d5ca887c0ee6 Jitendra Bhivare 2016-08-19 5369 * d1d5ca887c0ee6 Jitendra Bhivare 2016-08-19 5370 * Free the OS and HW resources held by the driver d1d5ca887c0ee6 Jitendra Bhivare 2016-08-19 5371 **/ d1d5ca887c0ee6 Jitendra Bhivare 2016-08-19 5372 static void beiscsi_disable_port(struct beiscsi_hba *phba, int unload) d1d5ca887c0ee6 Jitendra Bhivare 2016-08-19 5373 { d1d5ca887c0ee6 Jitendra Bhivare 2016-08-19 5374 struct hwi_context_memory *phwi_context; d1d5ca887c0ee6 Jitendra Bhivare 2016-08-19 5375 struct hwi_controller *phwi_ctrlr; d1d5ca887c0ee6 Jitendra Bhivare 2016-08-19 5376 struct be_eq_obj *pbe_eq; 831488669a334e Christoph Hellwig 2017-01-13 5377 unsigned int i; d1d5ca887c0ee6 Jitendra Bhivare 2016-08-19 5378 d1d5ca887c0ee6 Jitendra Bhivare 2016-08-19 5379 if (!test_and_clear_bit(BEISCSI_HBA_ONLINE, &phba->state)) d1d5ca887c0ee6 Jitendra Bhivare 2016-08-19 5380 return; d1d5ca887c0ee6 Jitendra Bhivare 2016-08-19 5381 d1d5ca887c0ee6 Jitendra Bhivare 2016-08-19 5382 phwi_ctrlr = phba->phwi_ctrlr; d1d5ca887c0ee6 Jitendra Bhivare 2016-08-19 5383 phwi_context = phwi_ctrlr->phwi_ctxt; d1d5ca887c0ee6 Jitendra Bhivare 2016-08-19 5384 hwi_disable_intr(phba); 45371aa398c647 Jitendra Bhivare 2017-10-10 5385 beiscsi_free_irqs(phba); 831488669a334e Christoph Hellwig 2017-01-13 5386 pci_free_irq_vectors(phba->pcidev); d1d5ca887c0ee6 Jitendra Bhivare 2016-08-19 5387 d1d5ca887c0ee6 Jitendra Bhivare 2016-08-19 5388 cancel_delayed_work_sync(&phba->eqd_update); d1d5ca887c0ee6 Jitendra Bhivare 2016-08-19 5389 cancel_work_sync(&phba->boot_work); d1d5ca887c0ee6 Jitendra Bhivare 2016-08-19 5390 /* WQ might be running cancel queued mcc_work if we are not exiting */ d1d5ca887c0ee6 Jitendra Bhivare 2016-08-19 5391 if (!unload && beiscsi_hba_in_error(phba)) { d1d5ca887c0ee6 Jitendra Bhivare 2016-08-19 @5392 pbe_eq = &phwi_context->be_eq[i]; d1d5ca887c0ee6 Jitendra Bhivare 2016-08-19 5393 cancel_work_sync(&pbe_eq->mcc_work); d1d5ca887c0ee6 Jitendra Bhivare 2016-08-19 5394 } d1d5ca887c0ee6 Jitendra Bhivare 2016-08-19 5395 hwi_cleanup_port(phba); dd940972f36779 Jitendra Bhivare 2016-12-13 5396 beiscsi_cleanup_port(phba); d1d5ca887c0ee6 Jitendra Bhivare 2016-08-19 5397 } d1d5ca887c0ee6 Jitendra Bhivare 2016-08-19 5398 --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org