OSDN Git Service

scsi: ufs: do not destroy clk scaling work queue if it is NULL
authorCan Guo <cang@codeaurora.org>
Thu, 1 Mar 2018 03:10:39 +0000 (11:10 +0800)
committerCan Guo <cang@codeaurora.org>
Wed, 7 Mar 2018 05:03:25 +0000 (13:03 +0800)
Function ufshcd_hba_exit might be called to destroy clk scaling work queue
if failure happends in function ufshcd_init before clk gating work queue
is created. This change fixs it by skipping destroying clk scaling work
queue if it is NULL.

Change-Id: Ifb1c46f490749e4afe7cea331c29d073175f68ef
Signed-off-by: Can Guo <cang@codeaurora.org>
drivers/scsi/ufs/ufshcd.c

index 9bf7f57..10021f2 100644 (file)
@@ -3,7 +3,7 @@
  *
  * This code is based on drivers/scsi/ufs/ufshcd.c
  * Copyright (C) 2011-2013 Samsung India Software Operations
- * Copyright (c) 2013-2017, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2013-2018, The Linux Foundation. All rights reserved.
  *
  * Authors:
  *     Santosh Yaraganavi <santosh.sy@samsung.com>
@@ -8431,7 +8431,8 @@ static void ufshcd_hba_exit(struct ufs_hba *hba)
                if (ufshcd_is_clkscaling_supported(hba)) {
                        if (hba->devfreq)
                                ufshcd_suspend_clkscaling(hba);
-                       destroy_workqueue(hba->clk_scaling.workq);
+                       if (hba->clk_scaling.workq)
+                               destroy_workqueue(hba->clk_scaling.workq);
                }
                ufshcd_disable_clocks(hba, false);
                ufshcd_setup_hba_vreg(hba, false);