From: Marcus Cooper <codekip...@gmail.com>

Signed-off-by: Marcus Cooper <codekip...@gmail.com>
---
 sound/soc/sunxi/spdif/sunxi_spdif.c | 27 +++++++++++++++++++--------
 1 file changed, 19 insertions(+), 8 deletions(-)

diff --git a/sound/soc/sunxi/spdif/sunxi_spdif.c 
b/sound/soc/sunxi/spdif/sunxi_spdif.c
index 7e76276..fe99aa0 100644
--- a/sound/soc/sunxi/spdif/sunxi_spdif.c
+++ b/sound/soc/sunxi/spdif/sunxi_spdif.c
@@ -489,11 +489,18 @@ static int sunxi_spdif_suspend(struct snd_soc_dai 
*cpu_dai)
        writel(reg_val, sunxi_spdif.regs + SUNXI_SPDIF_CTL);
 
        spdifregsave();
-
-       /* disable the module clock */
-       clk_disable(spdif_moduleclk);
-
-       clk_disable(spdif_apbclk);
+       if ((NULL == spdif_moduleclk) || (IS_ERR(spdif_moduleclk))) {
+               printk("spdif_moduleclk handle is invalid, just return\n");
+               return -EFAULT;
+       } else
+               /* disable the module clock */
+               clk_disable(spdif_moduleclk);
+
+       if ((NULL == spdif_apbclk) || (IS_ERR(spdif_apbclk))) {
+               printk("spdif_apbclk handle is invalid, just return\n");
+               return -EFAULT;
+       } else
+               clk_disable(spdif_apbclk);
 
        printk("[SPDIF]SPECIAL CLK 0x01c20068 = %#x, line= %d\n",
                                        *(volatile int *)0xF1C20068, __LINE__);
@@ -508,11 +515,15 @@ static int sunxi_spdif_resume(struct snd_soc_dai *cpu_dai)
        u32 reg_val;
        printk("[SPDIF]Enter %s\n", __func__);
 
-       /* disable the module clock */
-       clk_enable(spdif_apbclk);
+       /* enable the module clock */
+       if (clk_enable(spdif_apbclk)) {
+               printk("try to enable spdif_apbclk output failed!\n");
+       }
 
        /* enable the module clock */
-       clk_enable(spdif_moduleclk);
+       if (clk_enable(spdif_moduleclk)) {
+               printk("try to enable spdif_moduleclk output failed!\n");
+       }
 
        spdifregrestore();
 
-- 
1.9.1

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to