* [patch] crypto: tegra-aes - bitwise vs logical and
@ 2013-08-20 8:54 Dan Carpenter
2013-08-20 16:31 ` Stephen Warren
2013-08-21 11:51 ` Herbert Xu
0 siblings, 2 replies; 3+ messages in thread
From: Dan Carpenter @ 2013-08-20 8:54 UTC (permalink / raw)
To: Herbert Xu
Cc: David S. Miller, Stephen Warren, Grant Likely, Rob Herring,
linux-crypto, linux-tegra, devicetree, kernel-janitors
The bug here is that:
while (eng_busy & (!icq_empty) & dma_busy)
is never true because it's using bitwise instead of logical ANDs. The
other bitwise AND conditions work as intended but I changed them as well
for consistency.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
Static checker stuff. I don't have the hardware.
diff --git a/drivers/crypto/tegra-aes.c b/drivers/crypto/tegra-aes.c
index 85ea752..2d58da9 100644
--- a/drivers/crypto/tegra-aes.c
+++ b/drivers/crypto/tegra-aes.c
@@ -275,7 +275,7 @@ static int aes_start_crypt(struct tegra_aes_dev *dd, u32 in_addr, u32 out_addr,
value = aes_readl(dd, TEGRA_AES_INTR_STATUS);
eng_busy = value & TEGRA_AES_ENGINE_BUSY_FIELD;
icq_empty = value & TEGRA_AES_ICQ_EMPTY_FIELD;
- } while (eng_busy & (!icq_empty));
+ } while (eng_busy && !icq_empty);
aes_writel(dd, cmdq[i], TEGRA_AES_ICMDQUE_WR);
}
@@ -365,7 +365,7 @@ static int aes_set_key(struct tegra_aes_dev *dd)
eng_busy = value & TEGRA_AES_ENGINE_BUSY_FIELD;
icq_empty = value & TEGRA_AES_ICQ_EMPTY_FIELD;
dma_busy = value & TEGRA_AES_DMA_BUSY_FIELD;
- } while (eng_busy & (!icq_empty) & dma_busy);
+ } while (eng_busy && !icq_empty && dma_busy);
/* settable command to get key into internal registers */
value = CMD_SETTABLE << CMDQ_OPCODE_SHIFT |
@@ -379,7 +379,7 @@ static int aes_set_key(struct tegra_aes_dev *dd)
value = aes_readl(dd, TEGRA_AES_INTR_STATUS);
eng_busy = value & TEGRA_AES_ENGINE_BUSY_FIELD;
icq_empty = value & TEGRA_AES_ICQ_EMPTY_FIELD;
- } while (eng_busy & (!icq_empty));
+ } while (eng_busy && !icq_empty);
return 0;
}
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [patch] crypto: tegra-aes - bitwise vs logical and
2013-08-20 8:54 [patch] crypto: tegra-aes - bitwise vs logical and Dan Carpenter
@ 2013-08-20 16:31 ` Stephen Warren
2013-08-21 11:51 ` Herbert Xu
1 sibling, 0 replies; 3+ messages in thread
From: Stephen Warren @ 2013-08-20 16:31 UTC (permalink / raw)
To: Dan Carpenter, Varun Wadekar
Cc: Herbert Xu, David S. Miller, Grant Likely, Rob Herring,
linux-crypto, linux-tegra, devicetree, kernel-janitors
On 08/20/2013 02:54 AM, Dan Carpenter wrote:
> The bug here is that:
>
> while (eng_busy & (!icq_empty) & dma_busy)
>
> is never true because it's using bitwise instead of logical ANDs. The
> other bitwise AND conditions work as intended but I changed them as well
> for consistency.
>
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
> Static checker stuff. I don't have the hardware.
Varun, can you please test the driver with this change applied and make
sure it works correctly.
If you could also update our internal testing wiki with the steps you
use for this testing, that'd be great too.
Thanks.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [patch] crypto: tegra-aes - bitwise vs logical and
2013-08-20 8:54 [patch] crypto: tegra-aes - bitwise vs logical and Dan Carpenter
2013-08-20 16:31 ` Stephen Warren
@ 2013-08-21 11:51 ` Herbert Xu
1 sibling, 0 replies; 3+ messages in thread
From: Herbert Xu @ 2013-08-21 11:51 UTC (permalink / raw)
To: Dan Carpenter
Cc: David S. Miller, Stephen Warren, Grant Likely, Rob Herring,
linux-crypto, linux-tegra, devicetree, kernel-janitors
On Tue, Aug 20, 2013 at 11:54:48AM +0300, Dan Carpenter wrote:
> The bug here is that:
>
> while (eng_busy & (!icq_empty) & dma_busy)
>
> is never true because it's using bitwise instead of logical ANDs. The
> other bitwise AND conditions work as intended but I changed them as well
> for consistency.
>
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Also applied.
--
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-08-21 11:51 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-08-20 8:54 [patch] crypto: tegra-aes - bitwise vs logical and Dan Carpenter
2013-08-20 16:31 ` Stephen Warren
2013-08-21 11:51 ` Herbert Xu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).