Re: [PATCH v3 08/14] scsi: fnic: Add functionality in fnic to support FDLS

kernel test robot
2024-09-29T13:13:33Z

Hi Karan,

kernel test robot noticed the following build warnings:

[auto build test WARNING on mkp-scsi/for-next]
[also build test WARNING on jejb-scsi/for-next linus/master v6.11 next-20240927]
[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#_base_tree_information]

url: https://github.com/intel-lab-lkp/linux/commits/Karan-Tilak-Kumar/scsi-fnic-Replace-shost_printk-with-dev_info-dev_err/20240928-025906
base: https://git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git for-next
patch link: https://lore.kernel.org/r/20240927184613.52172-9-kartilak%40cisco.com
patch subject: [PATCH v3 08/14] scsi: fnic: Add functionality in fnic to support FDLS
config: x86_64-kexec (https://download.01.org/0day-ci/archive/20240929/202409292037.ZYWZwIK6-lkp@intel.com/config)
compiler: clang version 18.1.8 (https://github.com/llvm/llvm-project 3b5b5c1ec4a3095ab096dd780e84d7ab81f3d7ff)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240929/202409292037.ZYWZwIK6-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202409292037.ZYWZwIK6-lkp@intel.com/

All warnings (new ones prefixed by >>):

>> drivers/scsi/fnic/fnic_scsi.c:2618:6: warning: variable 'ret' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
2618 | if (fnic->link_status) {
| ^~~~~~~~~~~~~~~~~
drivers/scsi/fnic/fnic_scsi.c:2637:9: note: uninitialized use occurs here
2637 | return ret;
| ^~~
drivers/scsi/fnic/fnic_scsi.c:2618:2: note: remove the 'if' if its condition is always true
2618 | if (fnic->link_status) {
| ^~~~~~~~~~~~~~~~~~~~~~
drivers/scsi/fnic/fnic_scsi.c:2580:9: note: initialize the variable 'ret' to silence this warning
2580 | int ret;
| ^
| = 0
1 warning generated.
--
>> drivers/scsi/fnic/fnic_fcs.c:1031: warning: expecting prototype for fnic_tport_work(). Prototype was for fnic_tport_event_handler() instead

vim +2618 drivers/scsi/fnic/fnic_scsi.c

2568
2569 /*
2570 * SCSI Error handling calls driver's eh_host_reset if all prior
2571 * error handling levels return FAILED. If host reset completes
2572 * successfully, and if link is up, then Fabric login begins.
2573 *
2574 * Host Reset is the highest level of error recovery. If this fails, then
2575 * host is offlined by SCSI.
2576 *
2577 */
2578 int fnic_host_reset(struct Scsi_Host *shost)
2579 {
2580 int ret;
2581 unsigned long wait_host_tmo;
2582 struct fnic *fnic = *((struct fnic **) shost_priv(shost));
2583 unsigned long flags;
2584 struct fnic_iport_s *iport = &fnic->iport;
2585
2586 spin_lock_irqsave(&fnic->fnic_lock, flags);
2587 if (fnic->reset_in_progress == NOT_IN_PROGRESS) {
2588 fnic->reset_in_progress = IN_PROGRESS;
2589 } else {
2590 spin_unlock_irqrestore(&fnic->fnic_lock, flags);
2591 wait_for_completion_timeout(&fnic->reset_completion_wait,
2592 msecs_to_jiffies(10000));
2593
2594 spin_lock_irqsave(&fnic->fnic_lock, flags);
2595 if (fnic->reset_in_progress == IN_PROGRESS) {
2596 spin_unlock_irqrestore(&fnic->fnic_lock, flags);
2597 FNIC_SCSI_DBG(KERN_WARNING, fnic->lport->host, fnic->fnic_num,
2598 "Firmware reset in progress. Skipping another host reset\n");
2599 return SUCCESS;
2600 }
2601 fnic->reset_in_progress = IN_PROGRESS;
2602 }
2603 spin_unlock_irqrestore(&fnic->fnic_lock, flags);
2604
2605 /*
2606 * If fnic_reset is successful, wait for fabric login to complete
2607 * scsi-ml tries to send a TUR to every device if host reset is
2608 * successful, so before returning to scsi, fabric should be up
2609 */
2610 fnic_reset(shost);
2611
2612 spin_lock_irqsave(&fnic->fnic_lock, flags);
2613 fnic->reset_in_progress = NOT_IN_PROGRESS;
2614 complete(&fnic->reset_completion_wait);
2615 fnic->soft_reset_count++;
2616
2617 /* wait till the link is up */
> 2618 if (fnic->link_status) {
2619 wait_host_tmo = jiffies + FNIC_HOST_RESET_SETTLE_TIME * HZ;
2620 ret = FAILED;
2621 while (time_before(jiffies, wait_host_tmo)) {
2622 if (iport->state != FNIC_IPORT_STATE_READY
2623 && fnic->link_status) {
2624 spin_unlock_irqrestore(&fnic->fnic_lock, flags);
2625 ssleep(1);
2626 spin_lock_irqsave(&fnic->fnic_lock, flags);
2627 } else {
2628 ret = SUCCESS;
2629 break;
2630 }
2631 }
2632 }
2633 spin_unlock_irqrestore(&fnic->fnic_lock, flags);
2634
2635 FNIC_SCSI_DBG(KERN_INFO, fnic->lport->host, fnic->fnic_num,
2636 "host reset return status: %d\n", ret);
2637 return ret;
2638 }
2639

--
0-DAY CI Kernel Test Service