Skip to content

Commit 42e8b0d

Browse files
horiagherbertx
authored andcommitted
crypto: talitos - static code checker fixes
-change req_ctx->nbuf from u64 to unsigned int to silence checker warnings; this is safe since nbuf value is <= HASH_MAX_BLOCK_SIZE -remove unused value read from TALITOS_CCPSR; there is no requirement to read upper 32b before reading lower 32b of a 64b register; SEC RM mentions: "reads can always be done by byte, word, or dword" -remove unused return value of sg_to_link_tbl() -change "len" parameter of map_single_talitos_ptr() and to_talitos_ptr_len() to unsigned int; later, cpu_to_be16 will __force downcast the value to unsigned short without any checker warning Signed-off-by: Horia Geanta <horia.geanta@freescale.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
1 parent bde9079 commit 42e8b0d

1 file changed

Lines changed: 5 additions & 7 deletions

File tree

‎drivers/crypto/talitos.c‎

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ static void to_talitos_ptr(struct talitos_ptr *ptr, dma_addr_t dma_addr,
6363
ptr->eptr = upper_32_bits(dma_addr);
6464
}
6565

66-
static void to_talitos_ptr_len(struct talitos_ptr *ptr, unsigned short len,
66+
static void to_talitos_ptr_len(struct talitos_ptr *ptr, unsigned int len,
6767
bool is_sec1)
6868
{
6969
if (is_sec1) {
@@ -94,7 +94,7 @@ static void to_talitos_ptr_extent_clear(struct talitos_ptr *ptr, bool is_sec1)
9494
*/
9595
static void map_single_talitos_ptr(struct device *dev,
9696
struct talitos_ptr *ptr,
97-
unsigned short len, void *data,
97+
unsigned int len, void *data,
9898
enum dma_data_direction dir)
9999
{
100100
dma_addr_t dma_addr = dma_map_single(dev, data, len, dir);
@@ -543,7 +543,7 @@ static void talitos_error(struct device *dev, u32 isr, u32 isr_lo)
543543
struct talitos_private *priv = dev_get_drvdata(dev);
544544
unsigned int timeout = TALITOS_TIMEOUT;
545545
int ch, error, reset_dev = 0;
546-
u32 v, v_lo;
546+
u32 v_lo;
547547
bool is_sec1 = has_ftr_sec1(priv);
548548
int reset_ch = is_sec1 ? 1 : 0; /* only SEC2 supports continuation */
549549

@@ -560,7 +560,6 @@ static void talitos_error(struct device *dev, u32 isr, u32 isr_lo)
560560

561561
error = -EINVAL;
562562

563-
v = in_be32(priv->chan[ch].reg + TALITOS_CCPSR);
564563
v_lo = in_be32(priv->chan[ch].reg + TALITOS_CCPSR_LO);
565564

566565
if (v_lo & TALITOS_CCPSR_LO_DOF) {
@@ -815,7 +814,7 @@ struct talitos_ahash_req_ctx {
815814
unsigned int first;
816815
unsigned int last;
817816
unsigned int to_hash_later;
818-
u64 nbuf;
817+
unsigned int nbuf;
819818
struct scatterlist bufsl[2];
820819
struct scatterlist *psrc;
821820
};
@@ -1639,8 +1638,7 @@ void map_sg_out_talitos_ptr(struct device *dev, struct scatterlist *dst,
16391638
(edesc->src_nents + 1) *
16401639
sizeof(struct talitos_ptr), 0);
16411640
ptr->j_extent |= DESC_PTR_LNKTBL_JUMP;
1642-
sg_count = sg_to_link_tbl(dst, sg_count, len,
1643-
link_tbl_ptr);
1641+
sg_to_link_tbl(dst, sg_count, len, link_tbl_ptr);
16441642
dma_sync_single_for_device(dev, edesc->dma_link_tbl,
16451643
edesc->dma_len,
16461644
DMA_BIDIRECTIONAL);

0 commit comments

Comments
 (0)