Commit 8439e94f authored by Horia Geantă's avatar Horia Geantă Committed by Herbert Xu

crypto: caam - fix sparse warnings

Fix the following sparse warning (note that endianness issues
are not not addressed in current patch):

drivers/crypto/caam/ctrl.c:388:24: warning: incorrect type in argument 1 (different address spaces)
drivers/crypto/caam/ctrl.c:388:24:    expected void [noderef] <asn:2>*reg
drivers/crypto/caam/ctrl.c:388:24:    got unsigned int *<noident>
drivers/crypto/caam/ctrl.c:390:24: warning: incorrect type in argument 1 (different address spaces)
drivers/crypto/caam/ctrl.c:390:24:    expected void [noderef] <asn:2>*reg
drivers/crypto/caam/ctrl.c:390:24:    got unsigned int *<noident>
drivers/crypto/caam/ctrl.c:548:24: warning: incorrect type in assignment (different address spaces)
drivers/crypto/caam/ctrl.c:548:24:    expected struct caam_ctrl [noderef] <asn:2>*ctrl
drivers/crypto/caam/ctrl.c:548:24:    got struct caam_ctrl *<noident>
drivers/crypto/caam/ctrl.c:550:30: warning: cast removes address space of expression
drivers/crypto/caam/ctrl.c:549:26: warning: incorrect type in assignment (different address spaces)
drivers/crypto/caam/ctrl.c:549:26:    expected struct caam_assurance [noderef] <asn:2>*assure
drivers/crypto/caam/ctrl.c:549:26:    got struct caam_assurance *<noident>
drivers/crypto/caam/ctrl.c:554:28: warning: cast removes address space of expression
drivers/crypto/caam/ctrl.c:553:24: warning: incorrect type in assignment (different address spaces)
drivers/crypto/caam/ctrl.c:553:24:    expected struct caam_deco [noderef] <asn:2>*deco
drivers/crypto/caam/ctrl.c:553:24:    got struct caam_deco *<noident>
drivers/crypto/caam/ctrl.c:634:48: warning: cast removes address space of expression
drivers/crypto/caam/ctrl.c:633:44: warning: incorrect type in assignment (different address spaces)
drivers/crypto/caam/ctrl.c:633:44:    expected struct caam_job_ring [noderef] <asn:2>*<noident>
drivers/crypto/caam/ctrl.c:633:44:    got struct caam_job_ring *<noident>
drivers/crypto/caam/ctrl.c:648:34: warning: cast removes address space of expression
drivers/crypto/caam/ctrl.c:647:30: warning: incorrect type in assignment (different address spaces)
drivers/crypto/caam/ctrl.c:647:30:    expected struct caam_queue_if [noderef] <asn:2>*qi
drivers/crypto/caam/ctrl.c:647:30:    got struct caam_queue_if *<noident>
drivers/crypto/caam/ctrl.c:806:37: warning: incorrect type in assignment (different address spaces)
drivers/crypto/caam/ctrl.c:806:37:    expected void *data
drivers/crypto/caam/ctrl.c:806:37:    got unsigned int [noderef] <asn:2>*
drivers/crypto/caam/ctrl.c:814:38: warning: incorrect type in assignment (different address spaces)
drivers/crypto/caam/ctrl.c:814:38:    expected void *data
drivers/crypto/caam/ctrl.c:814:38:    got unsigned int [noderef] <asn:2>*
drivers/crypto/caam/ctrl.c:822:38: warning: incorrect type in assignment (different address spaces)
drivers/crypto/caam/ctrl.c:822:38:    expected void *data
drivers/crypto/caam/ctrl.c:822:38:    got unsigned int [noderef] <asn:2>*
drivers/crypto/caam/jr.c:492:23: warning: incorrect type in assignment (different address spaces)
drivers/crypto/caam/jr.c:492:23:    expected struct caam_job_ring [noderef] <asn:2>*rregs
drivers/crypto/caam/jr.c:492:23:    got struct caam_job_ring *<noident>
drivers/crypto/caam/caampkc.c:398:35: warning: Using plain integer as NULL pointer
drivers/crypto/caam/caampkc.c:444:35: warning: Using plain integer as NULL pointer
Signed-off-by: default avatarHoria Geantă <horia.geanta@nxp.com>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent 2090456a
...@@ -395,7 +395,7 @@ static int caam_rsa_set_pub_key(struct crypto_akcipher *tfm, const void *key, ...@@ -395,7 +395,7 @@ static int caam_rsa_set_pub_key(struct crypto_akcipher *tfm, const void *key,
unsigned int keylen) unsigned int keylen)
{ {
struct caam_rsa_ctx *ctx = akcipher_tfm_ctx(tfm); struct caam_rsa_ctx *ctx = akcipher_tfm_ctx(tfm);
struct rsa_key raw_key = {0}; struct rsa_key raw_key = {NULL};
struct caam_rsa_key *rsa_key = &ctx->key; struct caam_rsa_key *rsa_key = &ctx->key;
int ret; int ret;
...@@ -441,7 +441,7 @@ static int caam_rsa_set_priv_key(struct crypto_akcipher *tfm, const void *key, ...@@ -441,7 +441,7 @@ static int caam_rsa_set_priv_key(struct crypto_akcipher *tfm, const void *key,
unsigned int keylen) unsigned int keylen)
{ {
struct caam_rsa_ctx *ctx = akcipher_tfm_ctx(tfm); struct caam_rsa_ctx *ctx = akcipher_tfm_ctx(tfm);
struct rsa_key raw_key = {0}; struct rsa_key raw_key = {NULL};
struct caam_rsa_key *rsa_key = &ctx->key; struct caam_rsa_key *rsa_key = &ctx->key;
int ret; int ret;
......
...@@ -365,11 +365,8 @@ static void kick_trng(struct platform_device *pdev, int ent_delay) ...@@ -365,11 +365,8 @@ static void kick_trng(struct platform_device *pdev, int ent_delay)
*/ */
val = (rd_reg32(&r4tst->rtsdctl) & RTSDCTL_ENT_DLY_MASK) val = (rd_reg32(&r4tst->rtsdctl) & RTSDCTL_ENT_DLY_MASK)
>> RTSDCTL_ENT_DLY_SHIFT; >> RTSDCTL_ENT_DLY_SHIFT;
if (ent_delay <= val) { if (ent_delay <= val)
/* put RNG4 into run mode */ goto start_rng;
clrsetbits_32(&r4tst->rtmctl, RTMCTL_PRGM, 0);
return;
}
val = rd_reg32(&r4tst->rtsdctl); val = rd_reg32(&r4tst->rtsdctl);
val = (val & ~RTSDCTL_ENT_DLY_MASK) | val = (val & ~RTSDCTL_ENT_DLY_MASK) |
...@@ -381,15 +378,12 @@ static void kick_trng(struct platform_device *pdev, int ent_delay) ...@@ -381,15 +378,12 @@ static void kick_trng(struct platform_device *pdev, int ent_delay)
wr_reg32(&r4tst->rtfrqmax, RTFRQMAX_DISABLE); wr_reg32(&r4tst->rtfrqmax, RTFRQMAX_DISABLE);
/* read the control register */ /* read the control register */
val = rd_reg32(&r4tst->rtmctl); val = rd_reg32(&r4tst->rtmctl);
start_rng:
/* /*
* select raw sampling in both entropy shifter * select raw sampling in both entropy shifter
* and statistical checker * and statistical checker; ; put RNG4 into run mode
*/ */
clrsetbits_32(&val, 0, RTMCTL_SAMP_MODE_RAW_ES_SC); clrsetbits_32(&r4tst->rtmctl, RTMCTL_PRGM, RTMCTL_SAMP_MODE_RAW_ES_SC);
/* put RNG4 into run mode */
clrsetbits_32(&val, RTMCTL_PRGM, 0);
/* write back the control register */
wr_reg32(&r4tst->rtmctl, val);
} }
/** /**
...@@ -545,13 +539,13 @@ static int caam_probe(struct platform_device *pdev) ...@@ -545,13 +539,13 @@ static int caam_probe(struct platform_device *pdev)
else else
BLOCK_OFFSET = PG_SIZE_64K; BLOCK_OFFSET = PG_SIZE_64K;
ctrlpriv->ctrl = (struct caam_ctrl __force *)ctrl; ctrlpriv->ctrl = (struct caam_ctrl __iomem __force *)ctrl;
ctrlpriv->assure = (struct caam_assurance __force *) ctrlpriv->assure = (struct caam_assurance __iomem __force *)
((uint8_t *)ctrl + ((__force uint8_t *)ctrl +
BLOCK_OFFSET * ASSURE_BLOCK_NUMBER BLOCK_OFFSET * ASSURE_BLOCK_NUMBER
); );
ctrlpriv->deco = (struct caam_deco __force *) ctrlpriv->deco = (struct caam_deco __iomem __force *)
((uint8_t *)ctrl + ((__force uint8_t *)ctrl +
BLOCK_OFFSET * DECO_BLOCK_NUMBER BLOCK_OFFSET * DECO_BLOCK_NUMBER
); );
...@@ -630,8 +624,8 @@ static int caam_probe(struct platform_device *pdev) ...@@ -630,8 +624,8 @@ static int caam_probe(struct platform_device *pdev)
ring); ring);
continue; continue;
} }
ctrlpriv->jr[ring] = (struct caam_job_ring __force *) ctrlpriv->jr[ring] = (struct caam_job_ring __iomem __force *)
((uint8_t *)ctrl + ((__force uint8_t *)ctrl +
(ring + JR_BLOCK_NUMBER) * (ring + JR_BLOCK_NUMBER) *
BLOCK_OFFSET BLOCK_OFFSET
); );
...@@ -644,8 +638,8 @@ static int caam_probe(struct platform_device *pdev) ...@@ -644,8 +638,8 @@ static int caam_probe(struct platform_device *pdev)
!!(rd_reg32(&ctrl->perfmon.comp_parms_ms) & !!(rd_reg32(&ctrl->perfmon.comp_parms_ms) &
CTPR_MS_QI_MASK); CTPR_MS_QI_MASK);
if (ctrlpriv->qi_present) { if (ctrlpriv->qi_present) {
ctrlpriv->qi = (struct caam_queue_if __force *) ctrlpriv->qi = (struct caam_queue_if __iomem __force *)
((uint8_t *)ctrl + ((__force uint8_t *)ctrl +
BLOCK_OFFSET * QI_BLOCK_NUMBER BLOCK_OFFSET * QI_BLOCK_NUMBER
); );
/* This is all that's required to physically enable QI */ /* This is all that's required to physically enable QI */
...@@ -803,7 +797,7 @@ static int caam_probe(struct platform_device *pdev) ...@@ -803,7 +797,7 @@ static int caam_probe(struct platform_device *pdev)
&caam_fops_u32_ro); &caam_fops_u32_ro);
/* Internal covering keys (useful in non-secure mode only) */ /* Internal covering keys (useful in non-secure mode only) */
ctrlpriv->ctl_kek_wrap.data = &ctrlpriv->ctrl->kek[0]; ctrlpriv->ctl_kek_wrap.data = (__force void *)&ctrlpriv->ctrl->kek[0];
ctrlpriv->ctl_kek_wrap.size = KEK_KEY_SIZE * sizeof(u32); ctrlpriv->ctl_kek_wrap.size = KEK_KEY_SIZE * sizeof(u32);
ctrlpriv->ctl_kek = debugfs_create_blob("kek", ctrlpriv->ctl_kek = debugfs_create_blob("kek",
S_IRUSR | S_IRUSR |
...@@ -811,7 +805,7 @@ static int caam_probe(struct platform_device *pdev) ...@@ -811,7 +805,7 @@ static int caam_probe(struct platform_device *pdev)
ctrlpriv->ctl, ctrlpriv->ctl,
&ctrlpriv->ctl_kek_wrap); &ctrlpriv->ctl_kek_wrap);
ctrlpriv->ctl_tkek_wrap.data = &ctrlpriv->ctrl->tkek[0]; ctrlpriv->ctl_tkek_wrap.data = (__force void *)&ctrlpriv->ctrl->tkek[0];
ctrlpriv->ctl_tkek_wrap.size = KEK_KEY_SIZE * sizeof(u32); ctrlpriv->ctl_tkek_wrap.size = KEK_KEY_SIZE * sizeof(u32);
ctrlpriv->ctl_tkek = debugfs_create_blob("tkek", ctrlpriv->ctl_tkek = debugfs_create_blob("tkek",
S_IRUSR | S_IRUSR |
...@@ -819,7 +813,7 @@ static int caam_probe(struct platform_device *pdev) ...@@ -819,7 +813,7 @@ static int caam_probe(struct platform_device *pdev)
ctrlpriv->ctl, ctrlpriv->ctl,
&ctrlpriv->ctl_tkek_wrap); &ctrlpriv->ctl_tkek_wrap);
ctrlpriv->ctl_tdsk_wrap.data = &ctrlpriv->ctrl->tdsk[0]; ctrlpriv->ctl_tdsk_wrap.data = (__force void *)&ctrlpriv->ctrl->tdsk[0];
ctrlpriv->ctl_tdsk_wrap.size = KEK_KEY_SIZE * sizeof(u32); ctrlpriv->ctl_tdsk_wrap.size = KEK_KEY_SIZE * sizeof(u32);
ctrlpriv->ctl_tdsk = debugfs_create_blob("tdsk", ctrlpriv->ctl_tdsk = debugfs_create_blob("tdsk",
S_IRUSR | S_IRUSR |
......
...@@ -489,7 +489,7 @@ static int caam_jr_probe(struct platform_device *pdev) ...@@ -489,7 +489,7 @@ static int caam_jr_probe(struct platform_device *pdev)
return -ENOMEM; return -ENOMEM;
} }
jrpriv->rregs = (struct caam_job_ring __force *)ctrl; jrpriv->rregs = (struct caam_job_ring __iomem __force *)ctrl;
if (sizeof(dma_addr_t) == sizeof(u64)) if (sizeof(dma_addr_t) == sizeof(u64))
if (of_device_is_compatible(nprop, "fsl,sec-v5.0-job-ring")) if (of_device_is_compatible(nprop, "fsl,sec-v5.0-job-ring"))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment