scsi: ufs: Try to save power mode change and UIC cmd completion timeout
[ Renaming the files means that all these old warnings show up as new
warnings. I reported this two years ago but never heard back. -dan ]
Hello Can Guo,
This is a semi-automatic email about new static checker warnings.
The patch 0f52fcb99ea2: "scsi: ufs: Try to save power mode change and UIC cmd completion timeout" from Nov 2, 2020, leads to the following Smatch complaint:
drivers/ufs/core/ufshcd.c:5283 ufshcd_uic_cmd_compl()
error: we previously assumed 'hba->active_uic_cmd' could be null (see line 5271)drivers/ufs/core/ufshcd.c
5263 static irqreturn_t ufshcd_uic_cmd_compl(struct ufs_hba *hba, u32 intr_status)
5264 {
5265 irqreturn_t retval = IRQ_NONE;
5266
5267 spin_lock(hba->host->host_lock);
5268 if (ufshcd_is_auto_hibern8_error(hba, intr_status))
5269 hba->errors |= (UFSHCD_UIC_HIBERN8_MASK & intr_status);
5270
5271 if ((intr_status & UIC_COMMAND_COMPL) && hba->active_uic_cmd) {
^^^^^^^^^^^^^^^^^^^This code checks for NULL
5272 hba->active_uic_cmd->argument2 |=
5273 ufshcd_get_uic_cmd_result(hba);
5274 hba->active_uic_cmd->argument3 =
5275 ufshcd_get_dme_attr_val(hba);
5276 if (!hba->uic_async_done)
5277 hba->active_uic_cmd->cmd_active = 0;
5278 complete(&hba->active_uic_cmd->done);
5279 retval = IRQ_HANDLED;
5280 }
5281
5282 if ((intr_status & UFSHCD_UIC_PWR_MASK) && hba->uic_async_done) {
5283 hba->active_uic_cmd->cmd_active = 0;
^^^^^^^^^^^^^^^^^^^^^Unchecked dereference
5284 complete(hba->uic_async_done);
5285 retval = IRQ_HANDLED;
5286 }
5287
5288 if (retval == IRQ_HANDLED)
5289 ufshcd_add_uic_command_trace(hba, hba->active_uic_cmd,
^^^^^^^^^^^^^^^^^^^
Unchecked dereference
5290 UFS_CMD_COMP); 5291 spin_unlock(hba->host->host_lock); 5292 return retval; 5293 }
regards,
dan carpenter