diff mbox series

scsi: ufs: fix error return code of ufshcd_set_clk_freq()

Message ID 20210305100343.14304-1-baijiaju1990@gmail.com
State New
Headers show
Series scsi: ufs: fix error return code of ufshcd_set_clk_freq() | expand

Commit Message

Jia-Ju Bai March 5, 2021, 10:03 a.m. UTC
When the list of head is empty, no error return code of
ufshcd_set_clk_freq() is assigned.
To fix this bug, ret is assigned with -ENOENT as error return code.

Reported-by: TOTE Robot <oslab@tsinghua.edu.cn>
Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com>
---
 drivers/scsi/ufs/ufshcd.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
index 77161750c9fb..79899acb3ef6 100644
--- a/drivers/scsi/ufs/ufshcd.c
+++ b/drivers/scsi/ufs/ufshcd.c
@@ -970,8 +970,10 @@  static int ufshcd_set_clk_freq(struct ufs_hba *hba, bool scale_up)
 	struct ufs_clk_info *clki;
 	struct list_head *head = &hba->clk_list_head;
 
-	if (list_empty(head))
+	if (list_empty(head)) {
+		ret = -ENOENT;
 		goto out;
+	}
 
 	list_for_each_entry(clki, head, list) {
 		if (!IS_ERR_OR_NULL(clki->clk)) {