* [PATCH v3] scsi: ufs: use an generic error code in ufshcd_set_dev_pwr_mode
[not found] <CGME20220121053455epcas2p4f2710091dc5f722a220be91243c60eed@epcas2p4.samsung.com>
@ 2022-01-21 5:33 ` Kiwoong Kim
2022-01-22 0:41 ` Bart Van Assche
2022-01-25 5:41 ` Martin K. Petersen
0 siblings, 2 replies; 3+ messages in thread
From: Kiwoong Kim @ 2022-01-21 5:33 UTC (permalink / raw)
To: linux-scsi, linux-kernel, alim.akhtar, avri.altman, jejb,
martin.petersen, beanhuo, cang, adrian.hunter, sc.suh, hy50.seo,
sh425.lee, bhoon95.kim, vkumar.1997
Cc: Kiwoong Kim
v2 -> v3: change the value of ret only if it's positive
v1 -> v2: modify the comment of ufshcd_set_dev_pwr_mode
The return value of ufshcd_set_dev_pwr_mode is given to
device pm core. However, the function currently returns a result
in scsi command and the device pm core doesn't understand it.
It might lead to unexpected behaviors of user land. I found
the return value led to platform reset in Android.
This patch is to use an generic code for SSU failures.
Signed-off-by: Kiwoong Kim <kwmad.kim@samsung.com>
---
drivers/scsi/ufs/ufshcd.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
index 1049e41..25e08a3 100644
--- a/drivers/scsi/ufs/ufshcd.c
+++ b/drivers/scsi/ufs/ufshcd.c
@@ -8613,7 +8613,7 @@ static void ufshcd_hba_exit(struct ufs_hba *hba)
* @pwr_mode: device power mode to set
*
* Returns 0 if requested power mode is set successfully
- * Returns non-zero if failed to set the requested power mode
+ * Returns < 0 if failed to set the requested power mode
*/
static int ufshcd_set_dev_pwr_mode(struct ufs_hba *hba,
enum ufs_dev_pwr_mode pwr_mode)
@@ -8667,8 +8667,11 @@ static int ufshcd_set_dev_pwr_mode(struct ufs_hba *hba,
sdev_printk(KERN_WARNING, sdp,
"START_STOP failed for power mode: %d, result %x\n",
pwr_mode, ret);
- if (ret > 0 && scsi_sense_valid(&sshdr))
- scsi_print_sense_hdr(sdp, NULL, &sshdr);
+ if (ret > 0) {
+ if (scsi_sense_valid(&sshdr))
+ scsi_print_sense_hdr(sdp, NULL, &sshdr);
+ ret = -EIO;
+ }
}
if (!ret)
--
2.7.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v3] scsi: ufs: use an generic error code in ufshcd_set_dev_pwr_mode
2022-01-21 5:33 ` [PATCH v3] scsi: ufs: use an generic error code in ufshcd_set_dev_pwr_mode Kiwoong Kim
@ 2022-01-22 0:41 ` Bart Van Assche
2022-01-25 5:41 ` Martin K. Petersen
1 sibling, 0 replies; 3+ messages in thread
From: Bart Van Assche @ 2022-01-22 0:41 UTC (permalink / raw)
To: Kiwoong Kim, linux-scsi, linux-kernel, alim.akhtar, avri.altman,
jejb, martin.petersen, beanhuo, cang, adrian.hunter, sc.suh,
hy50.seo, sh425.lee, bhoon95.kim, vkumar.1997
On 1/20/22 21:33, Kiwoong Kim wrote:
> v2 -> v3: change the value of ret only if it's positive
> v1 -> v2: modify the comment of ufshcd_set_dev_pwr_mode
>
> The return value of ufshcd_set_dev_pwr_mode is given to
> device pm core. However, the function currently returns a result
> in scsi command and the device pm core doesn't understand it.
> It might lead to unexpected behaviors of user land. I found
> the return value led to platform reset in Android.
>
> This patch is to use an generic code for SSU failures.
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v3] scsi: ufs: use an generic error code in ufshcd_set_dev_pwr_mode
2022-01-21 5:33 ` [PATCH v3] scsi: ufs: use an generic error code in ufshcd_set_dev_pwr_mode Kiwoong Kim
2022-01-22 0:41 ` Bart Van Assche
@ 2022-01-25 5:41 ` Martin K. Petersen
1 sibling, 0 replies; 3+ messages in thread
From: Martin K. Petersen @ 2022-01-25 5:41 UTC (permalink / raw)
To: cang, avri.altman, sc.suh, beanhuo, bhoon95.kim, Kiwoong Kim,
vkumar.1997, hy50.seo, jejb, adrian.hunter, alim.akhtar,
sh425.lee, linux-scsi, linux-kernel
Cc: Martin K . Petersen
On Fri, 21 Jan 2022 14:33:02 +0900, Kiwoong Kim wrote:
> v2 -> v3: change the value of ret only if it's positive
> v1 -> v2: modify the comment of ufshcd_set_dev_pwr_mode
>
> The return value of ufshcd_set_dev_pwr_mode is given to
> device pm core. However, the function currently returns a result
> in scsi command and the device pm core doesn't understand it.
> It might lead to unexpected behaviors of user land. I found
> the return value led to platform reset in Android.
>
> [...]
Applied to 5.17/scsi-fixes, thanks!
[1/1] scsi: ufs: use an generic error code in ufshcd_set_dev_pwr_mode
https://git.kernel.org/mkp/scsi/c/ad6c8a426446
--
Martin K. Petersen Oracle Linux Engineering
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-01-25 5:44 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <CGME20220121053455epcas2p4f2710091dc5f722a220be91243c60eed@epcas2p4.samsung.com>
2022-01-21 5:33 ` [PATCH v3] scsi: ufs: use an generic error code in ufshcd_set_dev_pwr_mode Kiwoong Kim
2022-01-22 0:41 ` Bart Van Assche
2022-01-25 5:41 ` Martin K. Petersen
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.