staging: octeon-usb: use a helper function to set the DMA mask
authorAaro Koskinen <aaro.koskinen@iki.fi>
Tue, 4 Dec 2018 22:19:26 +0000 (00:19 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 5 Dec 2018 08:47:02 +0000 (09:47 +0100)
Use a helper function to set the DMA mask.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/octeon-usb/octeon-hcd.c

index 9c766f5b812fc03f14056fed3c2e4714904f2625..14982b6472a0fee17367aa58ea2869e4dc72b24e 100644 (file)
@@ -50,6 +50,7 @@
 #include <linux/module.h>
 #include <linux/usb/hcd.h>
 #include <linux/prefetch.h>
+#include <linux/dma-mapping.h>
 #include <linux/platform_device.h>
 
 #include <asm/octeon/octeon.h>
@@ -3606,8 +3607,9 @@ static int octeon_usb_probe(struct platform_device *pdev)
         * Set the DMA mask to 64bits so we get buffers already translated for
         * DMA.
         */
-       dev->coherent_dma_mask = ~0;
-       dev->dma_mask = &dev->coherent_dma_mask;
+       i = dma_coerce_mask_and_coherent(dev, DMA_BIT_MASK(64));
+       if (i)
+               return i;
 
        /*
         * Only cn52XX and cn56XX have DWC_OTG USB hardware and the