|
@@ -889,10 +889,14 @@ static inline void ufshcd_copy_sense_data(struct ufshcd_lrb *lrbp)
|
|
|
int len;
|
|
|
if (lrbp->sense_buffer &&
|
|
|
ufshcd_get_rsp_upiu_data_seg_len(lrbp->ucd_rsp_ptr)) {
|
|
|
+ int len_to_copy;
|
|
|
+
|
|
|
len = be16_to_cpu(lrbp->ucd_rsp_ptr->sr.sense_data_len);
|
|
|
+ len_to_copy = min_t(int, RESPONSE_UPIU_SENSE_DATA_LENGTH, len);
|
|
|
+
|
|
|
memcpy(lrbp->sense_buffer,
|
|
|
lrbp->ucd_rsp_ptr->sr.sense_data,
|
|
|
- min_t(int, len, SCSI_SENSE_BUFFERSIZE));
|
|
|
+ min_t(int, len_to_copy, SCSI_SENSE_BUFFERSIZE));
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -6091,7 +6095,10 @@ EXPORT_SYMBOL(ufshcd_system_suspend);
|
|
|
|
|
|
int ufshcd_system_resume(struct ufs_hba *hba)
|
|
|
{
|
|
|
- if (!hba || !hba->is_powered || pm_runtime_suspended(hba->dev))
|
|
|
+ if (!hba)
|
|
|
+ return -EINVAL;
|
|
|
+
|
|
|
+ if (!hba->is_powered || pm_runtime_suspended(hba->dev))
|
|
|
/*
|
|
|
* Let the runtime resume take care of resuming
|
|
|
* if runtime suspended.
|
|
@@ -6112,7 +6119,10 @@ EXPORT_SYMBOL(ufshcd_system_resume);
|
|
|
*/
|
|
|
int ufshcd_runtime_suspend(struct ufs_hba *hba)
|
|
|
{
|
|
|
- if (!hba || !hba->is_powered)
|
|
|
+ if (!hba)
|
|
|
+ return -EINVAL;
|
|
|
+
|
|
|
+ if (!hba->is_powered)
|
|
|
return 0;
|
|
|
|
|
|
return ufshcd_suspend(hba, UFS_RUNTIME_PM);
|
|
@@ -6142,10 +6152,13 @@ EXPORT_SYMBOL(ufshcd_runtime_suspend);
|
|
|
*/
|
|
|
int ufshcd_runtime_resume(struct ufs_hba *hba)
|
|
|
{
|
|
|
- if (!hba || !hba->is_powered)
|
|
|
+ if (!hba)
|
|
|
+ return -EINVAL;
|
|
|
+
|
|
|
+ if (!hba->is_powered)
|
|
|
return 0;
|
|
|
- else
|
|
|
- return ufshcd_resume(hba, UFS_RUNTIME_PM);
|
|
|
+
|
|
|
+ return ufshcd_resume(hba, UFS_RUNTIME_PM);
|
|
|
}
|
|
|
EXPORT_SYMBOL(ufshcd_runtime_resume);
|
|
|
|