diff mbox series

scsi: ufs: Check for return value of create_singlethread_workqueue

Message ID 20190319034732.19559-1-pakki001@umn.edu (mailing list archive)
State Changes Requested
Headers show
Series scsi: ufs: Check for return value of create_singlethread_workqueue | expand

Commit Message

Aditya Pakki March 19, 2019, 3:47 a.m. UTC
In case create_singlethread_workqueue fails in ufshcd_init_scaling, the
patch returns the error upstream.

Signed-off-by: Aditya Pakki <pakki001@umn.edu>
---
 drivers/scsi/ufs/ufshcd.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

Comments

Avri Altman March 26, 2019, 2:46 p.m. UTC | #1
HI,
> 
> In case create_singlethread_workqueue fails in ufshcd_init_scaling, the
> patch returns the error upstream.
> 
> Signed-off-by: Aditya Pakki <pakki001@umn.edu>
> ---


>  out_remove_scsi_host:
>  	scsi_remove_host(hba->host);
> -exit_gating:
> +exit_scaling:
>  	ufshcd_exit_clk_scaling(hba);
> +exit_gating:
>  	ufshcd_exit_clk_gating(hba);
There are calls to exit_gating which expects clk_scaling cleanup as well.

Thanks,
Avri

>  out_disable:
>  	hba->is_irq_enabled = false;
> --
> 2.17.1
diff mbox series

Patch

diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
index e040f9dd9ff3..e822f8eb0601 100644
--- a/drivers/scsi/ufs/ufshcd.c
+++ b/drivers/scsi/ufs/ufshcd.c
@@ -1748,12 +1748,12 @@  static ssize_t ufshcd_clkgate_enable_store(struct device *dev,
 	return count;
 }
 
-static void ufshcd_init_clk_scaling(struct ufs_hba *hba)
+static int ufshcd_init_clk_scaling(struct ufs_hba *hba)
 {
 	char wq_name[sizeof("ufs_clkscaling_00")];
 
 	if (!ufshcd_is_clkscaling_supported(hba))
-		return;
+		return 0;
 
 	INIT_WORK(&hba->clk_scaling.suspend_work,
 		  ufshcd_clk_scaling_suspend_work);
@@ -1763,8 +1763,11 @@  static void ufshcd_init_clk_scaling(struct ufs_hba *hba)
 	snprintf(wq_name, sizeof(wq_name), "ufs_clkscaling_%d",
 		 hba->host->host_no);
 	hba->clk_scaling.workq = create_singlethread_workqueue(wq_name);
+	if (!hba->clk_scaling.workq)
+		return -ENOMEM;
 
 	ufshcd_clkscaling_init_sysfs(hba);
+	return 0;
 }
 
 static void ufshcd_exit_clk_scaling(struct ufs_hba *hba)
@@ -8256,7 +8259,9 @@  int ufshcd_init(struct ufs_hba *hba, void __iomem *mmio_base, unsigned int irq)
 
 	ufshcd_init_clk_gating(hba);
 
-	ufshcd_init_clk_scaling(hba);
+	err = ufshcd_init_clk_scaling(hba);
+	if (err)
+		goto exit_scaling;
 
 	/*
 	 * In order to avoid any spurious interrupt immediately after
@@ -8332,8 +8337,9 @@  int ufshcd_init(struct ufs_hba *hba, void __iomem *mmio_base, unsigned int irq)
 
 out_remove_scsi_host:
 	scsi_remove_host(hba->host);
-exit_gating:
+exit_scaling:
 	ufshcd_exit_clk_scaling(hba);
+exit_gating:
 	ufshcd_exit_clk_gating(hba);
 out_disable:
 	hba->is_irq_enabled = false;