diff options
author | Franck LENORMAND <franck.lenormand@nxp.com> | 2018-06-26 13:10:55 +0200 |
---|---|---|
committer | Jason Liu <jason.hui.liu@nxp.com> | 2018-10-29 11:10:38 +0800 |
commit | 278d4b127292943eaeb49f23d8a99598ea8954bd (patch) | |
tree | a659497ccea41dd55a1a9bcb71689bc129caa1cb /drivers/crypto | |
parent | d5db058b72c131cdfb0401735e8cebdb2a02ba7b (diff) |
MLK-18082: crypto: caam: Check ret value of dma_set_mask_and_coherent
Signed-off-by: Franck LENORMAND <franck.lenormand@nxp.com>
Diffstat (limited to 'drivers/crypto')
-rw-r--r-- | drivers/crypto/caam/ctrl.c | 40 |
1 files changed, 32 insertions, 8 deletions
diff --git a/drivers/crypto/caam/ctrl.c b/drivers/crypto/caam/ctrl.c index a3ba3b7281ec..a437b27472dd 100644 --- a/drivers/crypto/caam/ctrl.c +++ b/drivers/crypto/caam/ctrl.c @@ -426,13 +426,24 @@ static int caam_probe(struct platform_device *pdev) check_virt(ctrlpriv, comp_params); /* Set DMA masks according to platform ranging */ - if (sizeof(dma_addr_t) == sizeof(u64)) + if (of_machine_is_compatible("fsl,imx8mm") || + of_machine_is_compatible("fsl,imx8qm") || + of_machine_is_compatible("fsl,imx8qxp") || + of_machine_is_compatible("fsl,imx8mq")) { + ret = dma_set_mask_and_coherent(dev, DMA_BIT_MASK(32)); + } else if (sizeof(dma_addr_t) == sizeof(u64)) if (of_device_is_compatible(nprop, "fsl,sec-v5.0")) - dma_set_mask_and_coherent(dev, DMA_BIT_MASK(40)); + ret = dma_set_mask_and_coherent(dev, DMA_BIT_MASK(40)); else - dma_set_mask_and_coherent(dev, DMA_BIT_MASK(36)); + ret = dma_set_mask_and_coherent(dev, DMA_BIT_MASK(36)); else - dma_set_mask_and_coherent(dev, DMA_BIT_MASK(32)); + ret = dma_set_mask_and_coherent(dev, DMA_BIT_MASK(32)); + + if (ret) { + dev_err(dev, "dma_set_mask_and_coherent failed (%d)\n", + ret); + goto iounmap_ctrl; + } ret = enable_jobrings(ctrlpriv, block_offset); if (ret) @@ -660,16 +671,29 @@ static int probe_w_seco(struct caam_drv_private *ctrlpriv) */ /* Set DMA masks according to platform ranging */ - if (sizeof(dma_addr_t) == sizeof(u64)) + if (of_machine_is_compatible("fsl,imx8mm") || + of_machine_is_compatible("fsl,imx8qm") || + of_machine_is_compatible("fsl,imx8qxp") || + of_machine_is_compatible("fsl,imx8mq")) { + ret = dma_set_mask_and_coherent(ctrlpriv->dev, + DMA_BIT_MASK(32)); + } else if (sizeof(dma_addr_t) == sizeof(u64)) if (of_device_is_compatible(ctrlpriv->pdev->dev.of_node, "fsl,sec-v5.0")) - dma_set_mask_and_coherent(ctrlpriv->dev, + ret = dma_set_mask_and_coherent(ctrlpriv->dev, DMA_BIT_MASK(40)); else - dma_set_mask_and_coherent(ctrlpriv->dev, + ret = dma_set_mask_and_coherent(ctrlpriv->dev, DMA_BIT_MASK(36)); else - dma_set_mask_and_coherent(ctrlpriv->dev, DMA_BIT_MASK(32)); + ret = dma_set_mask_and_coherent(ctrlpriv->dev, + DMA_BIT_MASK(32)); + + if (ret) { + dev_err(ctrlpriv->dev, "dma_set_mask_and_coherent failed (%d)\n", + ret); + return ret; + } /* * this is where we should run the descriptor for DRNG init |