crypto: tegra-aes: call INIT_COMPLETION before setting the transfer
Varun Wadekar [Tue, 11 Jan 2011 08:33:54 +0000 (13:33 +0530)]
Change-Id: I368a9bf8aa1c311532e54d18a813b556576b8da1
Signed-off-by: Varun Wadekar <vwadekar@nvidia.com>

drivers/crypto/tegra-aes.c

index ef17074..9aed3e8 100644 (file)
@@ -309,6 +309,7 @@ static int aes_start_crypt(struct tegra_aes_dev *dd, u32 in_addr, u32 out_addr,
        aes_writel(dd, value, SECURE_INPUT_SELECT);
 
        aes_writel(dd, out_addr, SECURE_DEST_ADDR);
+       INIT_COMPLETION(dd->op_complete);
 
        for (i = 0; i < qlen - 1; i++) {
                do {
@@ -320,7 +321,6 @@ static int aes_start_crypt(struct tegra_aes_dev *dd, u32 in_addr, u32 out_addr,
                aes_writel(dd, cmdq[i], ICMDQUE_WR);
        }
 
-       INIT_COMPLETION(dd->op_complete);
        ret = wait_for_completion_timeout(&dd->op_complete, msecs_to_jiffies(150));
        if (ret == 0) {
                dev_err(dd->dev, "timed out (0x%x)\n",