Re: [PATCH v6 09/18] crypto: sun8i-ce: split into prepare/run/unprepare

From: Herbert Xu
Date: Fri Sep 11 2020 - 02:37:05 EST


On Fri, Sep 04, 2020 at 11:09:54AM +0000, Corentin Labbe wrote:
>
> +static int sun8i_ce_cipher_unprepare(struct crypto_engine *engine, void *async_req)
> +{
> + struct skcipher_request *areq = container_of(async_req, struct skcipher_request, base);
> + struct crypto_skcipher *tfm = crypto_skcipher_reqtfm(areq);
> + struct sun8i_cipher_tfm_ctx *op = crypto_skcipher_ctx(tfm);
> + struct sun8i_ce_dev *ce = op->ce;
> + struct sun8i_cipher_req_ctx *rctx = skcipher_request_ctx(areq);
> + struct sun8i_ce_flow *chan;
> + struct ce_task *cet;
> + unsigned int ivsize, offset;
> + int nr_sgs = rctx->nr_sgs;
> + int nr_sgd = rctx->nr_sgd;
> + int flow;
> +
> + flow = rctx->flow;
> + chan = &ce->chanlist[flow];
> + cet = chan->tl;
> + ivsize = crypto_skcipher_ivsize(tfm);
> +
> + if (areq->src == areq->dst) {
> + dma_unmap_sg(ce->dev, areq->src, nr_sgs, DMA_BIDIRECTIONAL);
> + } else {
> + if (nr_sgs > 0)
> + dma_unmap_sg(ce->dev, areq->src, nr_sgs, DMA_TO_DEVICE);
> + dma_unmap_sg(ce->dev, areq->dst, nr_sgd, DMA_FROM_DEVICE);
> + }
> +
> + if (areq->iv && ivsize > 0) {
> + if (cet->t_iv)
> + dma_unmap_single(ce->dev, cet->t_iv, rctx->ivlen,
> + DMA_TO_DEVICE);

This creates a sparse warning:

CHECK ../drivers/crypto/allwinner/sun8i-ce/sun8i-ce-cipher.c
../drivers/crypto/allwinner/sun8i-ce/sun8i-ce-cipher.c:311:25: warning: incorrect type in argument 2 (different base types)
../drivers/crypto/allwinner/sun8i-ce/sun8i-ce-cipher.c:311:25: expected unsigned long long [usertype] addr
../drivers/crypto/allwinner/sun8i-ce/sun8i-ce-cipher.c:311:25: got restricted __le32 [usertype] t_iv
../drivers/crypto/allwinner/sun8i-ce/sun8i-ce-cipher.c:322:9: warning: incorrect type in argument 2 (different base types)
../drivers/crypto/allwinner/sun8i-ce/sun8i-ce-cipher.c:322:9: expected unsigned long long [usertype] addr
../drivers/crypto/allwinner/sun8i-ce/sun8i-ce-cipher.c:322:9: got restricted __le32 [usertype] t_key

Please fix. Thanks,
--
Email: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt