This is a note to let you know that I've just added the patch titled scsi: ufs: Try harder to change the power mode to the 6.1-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: scsi-ufs-try-harder-to-change-the-power-mode.patch and it can be found in the queue-6.1 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. commit f70636a91569e7c4032dd7baf9647c5f16f044d4 Author: Bart Van Assche <bvanassche@xxxxxxx> Date: Tue Oct 18 13:29:55 2022 -0700 scsi: ufs: Try harder to change the power mode [ Upstream commit 579a4e9dbd53978cad8df88dc612837cdd210ce0 ] Instead of only retrying the START STOP UNIT command if a unit attention is reported, repeat it if any SCSI error is reported by the device or if the command timed out. Signed-off-by: Bart Van Assche <bvanassche@xxxxxxx> Link: https://lore.kernel.org/r/20221018202958.1902564-8-bvanassche@xxxxxxx Signed-off-by: Martin K. Petersen <martin.petersen@xxxxxxxxxx> Stable-dep-of: fe8637f7708c ("scsi: ufs: core: Increase the START STOP UNIT timeout from one to ten seconds") Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx> diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c index 977bd4b9dd0b4..36437d39b93c8 100644 --- a/drivers/ufs/core/ufshcd.c +++ b/drivers/ufs/core/ufshcd.c @@ -8830,9 +8830,11 @@ static int ufshcd_set_dev_pwr_mode(struct ufs_hba *hba, for (retries = 3; retries > 0; --retries) { ret = scsi_execute(sdp, cmd, DMA_NONE, NULL, 0, NULL, &sshdr, HZ, 0, 0, RQF_PM, NULL); - if (!scsi_status_is_check_condition(ret) || - !scsi_sense_valid(&sshdr) || - sshdr.sense_key != UNIT_ATTENTION) + /* + * scsi_execute() only returns a negative value if the request + * queue is dying. + */ + if (ret <= 0) break; } if (ret) {