scsi: ufs: Serialize eh_work with system PM events and async scan
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