public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
* [bug report] scsi: ufs: Serialize eh_work with system PM events and async scan
@ 2020-12-11 10:06 Dan Carpenter
  0 siblings, 0 replies; only message in thread
From: Dan Carpenter @ 2020-12-11 10:06 UTC (permalink / raw)
  To: cang; +Cc: linux-scsi

Hello Can Guo,

This is a semi-automatic email about new static checker warnings.

The patch 88a92d6ae4fe: "scsi: ufs: Serialize eh_work with system PM
events and async scan" from Dec 2, 2020, leads to the following
Smatch complaint:

    drivers/scsi/ufs/ufshcd.c:8971 ufshcd_system_resume()
    error: we previously assumed 'hba' could be null (see line 8970)

drivers/scsi/ufs/ufshcd.c
  8965  int ufshcd_system_resume(struct ufs_hba *hba)
  8966  {
  8967          int ret = 0;
  8968          ktime_t start = ktime_get();
  8969  
  8970          if (!hba) {
  8971                  up(&hba->eh_sem);

If "hba" is NULL then this will Oops, but I suspect that we could just
remove the check for NULL.

  8972                  return -EINVAL;
  8973          }
  8974  
  8975          if (!hba->is_powered || pm_runtime_suspended(hba->dev))
  8976                  /*
  8977                   * Let the runtime resume take care of resuming
  8978                   * if runtime suspended.
  8979                   */
  8980                  goto out;
  8981          else
  8982                  ret = ufshcd_resume(hba, UFS_SYSTEM_PM);
  8983  out:
  8984          trace_ufshcd_system_resume(dev_name(hba->dev), ret,
  8985                  ktime_to_us(ktime_sub(ktime_get(), start)),
  8986                  hba->curr_dev_pwr_mode, hba->uic_link_state);
  8987          if (!ret)
  8988                  hba->is_sys_suspended = false;
  8989          up(&hba->eh_sem);
  8990          return ret;
  8991  }

regards,
dan carpenter

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-12-11 10:08 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-12-11 10:06 [bug report] scsi: ufs: Serialize eh_work with system PM events and async scan Dan Carpenter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox