crypto: mxs-dcp - Align the bounce buffers
[deliverable/linux.git] / drivers / crypto / mxs-dcp.c
index 37e0706707027d291ad9ad347dadde13852b8ba7..c7400fe9522c19ccb2b223c27895d64b795c5170 100644 (file)
@@ -29,6 +29,8 @@
 #define DCP_MAX_CHANS  4
 #define DCP_BUF_SZ     PAGE_SIZE
 
+#define DCP_ALIGNMENT  64
+
 /* DCP DMA descriptor. */
 struct dcp_dma_desc {
        uint32_t        next_cmd_addr;
@@ -908,9 +910,14 @@ static int mxs_dcp_probe(struct platform_device *pdev)
 
        iores = platform_get_resource(pdev, IORESOURCE_MEM, 0);
        dcp_vmi_irq = platform_get_irq(pdev, 0);
+       if (dcp_vmi_irq < 0) {
+               ret = dcp_vmi_irq;
+               goto err_mutex;
+       }
+
        dcp_irq = platform_get_irq(pdev, 1);
-       if (dcp_vmi_irq < 0 || dcp_irq < 0) {
-               ret = -EINVAL;
+       if (dcp_irq < 0) {
+               ret = dcp_irq;
                goto err_mutex;
        }
 
@@ -942,12 +949,16 @@ static int mxs_dcp_probe(struct platform_device *pdev)
        }
 
        /* Allocate coherent helper block. */
-       sdcp->coh = devm_kzalloc(dev, sizeof(*sdcp->coh), GFP_KERNEL);
+       sdcp->coh = devm_kzalloc(dev, sizeof(*sdcp->coh) + DCP_ALIGNMENT,
+                                  GFP_KERNEL);
        if (!sdcp->coh) {
                ret = -ENOMEM;
                goto err_mutex;
        }
 
+       /* Re-align the structure so it fits the DCP constraints. */
+       sdcp->coh = PTR_ALIGN(sdcp->coh, DCP_ALIGNMENT);
+
        /* Restart the DCP block. */
        ret = stmp_reset_block(sdcp->base);
        if (ret)
This page took 0.026534 seconds and 5 git commands to generate.