Skip to content

Commit ad6c8a4

Browse files
Kiwoong Kimmartinkpetersen
authored andcommitted
scsi: ufs: Use generic error code in ufshcd_set_dev_pwr_mode()
The return value of ufshcd_set_dev_pwr_mode() is passed to device PM core. However, the function currently returns a SCSI result which the PM core doesn't understand. This might lead to unexpected behaviors in userland; a platform reset was observed in Android. Use a generic error code for SSU failures. Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Bart Van Assche <[email protected]> Signed-off-by: Kiwoong Kim <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
1 parent 012d98d commit ad6c8a4

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

drivers/scsi/ufs/ufshcd.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8613,7 +8613,7 @@ static void ufshcd_hba_exit(struct ufs_hba *hba)
86138613
* @pwr_mode: device power mode to set
86148614
*
86158615
* Returns 0 if requested power mode is set successfully
8616-
* Returns non-zero if failed to set the requested power mode
8616+
* Returns < 0 if failed to set the requested power mode
86178617
*/
86188618
static int ufshcd_set_dev_pwr_mode(struct ufs_hba *hba,
86198619
enum ufs_dev_pwr_mode pwr_mode)
@@ -8667,8 +8667,11 @@ static int ufshcd_set_dev_pwr_mode(struct ufs_hba *hba,
86678667
sdev_printk(KERN_WARNING, sdp,
86688668
"START_STOP failed for power mode: %d, result %x\n",
86698669
pwr_mode, ret);
8670-
if (ret > 0 && scsi_sense_valid(&sshdr))
8671-
scsi_print_sense_hdr(sdp, NULL, &sshdr);
8670+
if (ret > 0) {
8671+
if (scsi_sense_valid(&sshdr))
8672+
scsi_print_sense_hdr(sdp, NULL, &sshdr);
8673+
ret = -EIO;
8674+
}
86728675
}
86738676

86748677
if (!ret)

0 commit comments

Comments
 (0)