aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRussell King <rmk+kernel@arm.linux.org.uk>2013-06-10 11:28:49 -0400
committerRussell King <rmk+kernel@arm.linux.org.uk>2013-10-31 10:49:01 -0400
commit22d9d8e8316d7f69046c8805ce9aa8d9c43d4e5b (patch)
tree08dac036c1fdeb9c49940b3a7760860849eee65c
parent93b11b2584ab6832cb279db731daa58442baac65 (diff)
DMA-API: usb: use dma_set_coherent_mask()
The correct way for a driver to specify the coherent DMA mask is not to directly access the field in the struct device, but to use dma_set_coherent_mask(). Only arch and bus code should access this member directly. Convert all direct write accesses to using the correct API. Acked-by: Felipe Balbi <balbi@ti.com> Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
-rw-r--r--drivers/usb/chipidea/ci_hdrc_imx.c5
-rw-r--r--drivers/usb/dwc3/dwc3-exynos.c5
-rw-r--r--drivers/usb/gadget/lpc32xx_udc.c4
-rw-r--r--drivers/usb/host/ehci-atmel.c5
-rw-r--r--drivers/usb/host/ehci-octeon.c4
-rw-r--r--drivers/usb/host/ehci-omap.c8
-rw-r--r--drivers/usb/host/ehci-orion.c5
-rw-r--r--drivers/usb/host/ehci-platform.c7
-rw-r--r--drivers/usb/host/ehci-s5p.c5
-rw-r--r--drivers/usb/host/ehci-spear.c5
-rw-r--r--drivers/usb/host/ehci-tegra.c5
-rw-r--r--drivers/usb/host/ohci-at91.c7
-rw-r--r--drivers/usb/host/ohci-exynos.c5
-rw-r--r--drivers/usb/host/ohci-nxp.c4
-rw-r--r--drivers/usb/host/ohci-octeon.c4
-rw-r--r--drivers/usb/host/ohci-omap3.c8
-rw-r--r--drivers/usb/host/ohci-pxa27x.c6
-rw-r--r--drivers/usb/host/ohci-spear.c5
-rw-r--r--drivers/usb/host/uhci-platform.c5
19 files changed, 64 insertions, 38 deletions
diff --git a/drivers/usb/chipidea/ci_hdrc_imx.c b/drivers/usb/chipidea/ci_hdrc_imx.c
index 74d998d9b45b..bf33bd3e27b1 100644
--- a/drivers/usb/chipidea/ci_hdrc_imx.c
+++ b/drivers/usb/chipidea/ci_hdrc_imx.c
@@ -123,8 +123,9 @@ static int ci_hdrc_imx_probe(struct platform_device *pdev)
123 123
124 if (!pdev->dev.dma_mask) 124 if (!pdev->dev.dma_mask)
125 pdev->dev.dma_mask = &pdev->dev.coherent_dma_mask; 125 pdev->dev.dma_mask = &pdev->dev.coherent_dma_mask;
126 if (!pdev->dev.coherent_dma_mask) 126 ret = dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32));
127 pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32); 127 if (ret)
128 goto err_clk;
128 129
129 if (data->usbmisc_data) { 130 if (data->usbmisc_data) {
130 ret = imx_usbmisc_init(data->usbmisc_data); 131 ret = imx_usbmisc_init(data->usbmisc_data);
diff --git a/drivers/usb/dwc3/dwc3-exynos.c b/drivers/usb/dwc3/dwc3-exynos.c
index 2f2e88a3a11a..c10b3248e047 100644
--- a/drivers/usb/dwc3/dwc3-exynos.c
+++ b/drivers/usb/dwc3/dwc3-exynos.c
@@ -121,8 +121,9 @@ static int dwc3_exynos_probe(struct platform_device *pdev)
121 */ 121 */
122 if (!dev->dma_mask) 122 if (!dev->dma_mask)
123 dev->dma_mask = &dev->coherent_dma_mask; 123 dev->dma_mask = &dev->coherent_dma_mask;
124 if (!dev->coherent_dma_mask) 124 ret = dma_set_coherent_mask(dev, DMA_BIT_MASK(32));
125 dev->coherent_dma_mask = DMA_BIT_MASK(32); 125 if (ret)
126 goto err1;
126 127
127 platform_set_drvdata(pdev, exynos); 128 platform_set_drvdata(pdev, exynos);
128 129
diff --git a/drivers/usb/gadget/lpc32xx_udc.c b/drivers/usb/gadget/lpc32xx_udc.c
index 67128be1e1b7..6a2a65aa0057 100644
--- a/drivers/usb/gadget/lpc32xx_udc.c
+++ b/drivers/usb/gadget/lpc32xx_udc.c
@@ -3078,7 +3078,9 @@ static int __init lpc32xx_udc_probe(struct platform_device *pdev)
3078 udc->isp1301_i2c_client->addr); 3078 udc->isp1301_i2c_client->addr);
3079 3079
3080 pdev->dev.dma_mask = &lpc32xx_usbd_dmamask; 3080 pdev->dev.dma_mask = &lpc32xx_usbd_dmamask;
3081 pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32); 3081 retval = dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32));
3082 if (retval)
3083 goto resource_fail;
3082 3084
3083 udc->board = &lpc32xx_usbddata; 3085 udc->board = &lpc32xx_usbddata;
3084 3086
diff --git a/drivers/usb/host/ehci-atmel.c b/drivers/usb/host/ehci-atmel.c
index 3b645ff46f7b..5831a88623e4 100644
--- a/drivers/usb/host/ehci-atmel.c
+++ b/drivers/usb/host/ehci-atmel.c
@@ -92,8 +92,9 @@ static int ehci_atmel_drv_probe(struct platform_device *pdev)
92 */ 92 */
93 if (!pdev->dev.dma_mask) 93 if (!pdev->dev.dma_mask)
94 pdev->dev.dma_mask = &pdev->dev.coherent_dma_mask; 94 pdev->dev.dma_mask = &pdev->dev.coherent_dma_mask;
95 if (!pdev->dev.coherent_dma_mask) 95 retval = dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32));
96 pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32); 96 if (retval)
97 goto fail_create_hcd;
97 98
98 hcd = usb_create_hcd(driver, &pdev->dev, dev_name(&pdev->dev)); 99 hcd = usb_create_hcd(driver, &pdev->dev, dev_name(&pdev->dev));
99 if (!hcd) { 100 if (!hcd) {
diff --git a/drivers/usb/host/ehci-octeon.c b/drivers/usb/host/ehci-octeon.c
index ab0397e4d8f3..4c528b2c033a 100644
--- a/drivers/usb/host/ehci-octeon.c
+++ b/drivers/usb/host/ehci-octeon.c
@@ -116,8 +116,10 @@ static int ehci_octeon_drv_probe(struct platform_device *pdev)
116 * We can DMA from anywhere. But the descriptors must be in 116 * We can DMA from anywhere. But the descriptors must be in
117 * the lower 4GB. 117 * the lower 4GB.
118 */ 118 */
119 pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32);
120 pdev->dev.dma_mask = &ehci_octeon_dma_mask; 119 pdev->dev.dma_mask = &ehci_octeon_dma_mask;
120 ret = dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32));
121 if (ret)
122 return ret;
121 123
122 hcd = usb_create_hcd(&ehci_octeon_hc_driver, &pdev->dev, "octeon"); 124 hcd = usb_create_hcd(&ehci_octeon_hc_driver, &pdev->dev, "octeon");
123 if (!hcd) 125 if (!hcd)
diff --git a/drivers/usb/host/ehci-omap.c b/drivers/usb/host/ehci-omap.c
index 78b01fa475bb..d0759c5c03ab 100644
--- a/drivers/usb/host/ehci-omap.c
+++ b/drivers/usb/host/ehci-omap.c
@@ -104,7 +104,7 @@ static int ehci_hcd_omap_probe(struct platform_device *pdev)
104 struct resource *res; 104 struct resource *res;
105 struct usb_hcd *hcd; 105 struct usb_hcd *hcd;
106 void __iomem *regs; 106 void __iomem *regs;
107 int ret = -ENODEV; 107 int ret;
108 int irq; 108 int irq;
109 int i; 109 int i;
110 struct omap_hcd *omap; 110 struct omap_hcd *omap;
@@ -146,9 +146,11 @@ static int ehci_hcd_omap_probe(struct platform_device *pdev)
146 */ 146 */
147 if (!dev->dma_mask) 147 if (!dev->dma_mask)
148 dev->dma_mask = &dev->coherent_dma_mask; 148 dev->dma_mask = &dev->coherent_dma_mask;
149 if (!dev->coherent_dma_mask) 149 ret = dma_set_coherent_mask(dev, DMA_BIT_MASK(32));
150 dev->coherent_dma_mask = DMA_BIT_MASK(32); 150 if (ret)
151 return ret;
151 152
153 ret = -ENODEV;
152 hcd = usb_create_hcd(&ehci_omap_hc_driver, dev, 154 hcd = usb_create_hcd(&ehci_omap_hc_driver, dev,
153 dev_name(dev)); 155 dev_name(dev));
154 if (!hcd) { 156 if (!hcd) {
diff --git a/drivers/usb/host/ehci-orion.c b/drivers/usb/host/ehci-orion.c
index d1dfb9db5b42..58702066a8b7 100644
--- a/drivers/usb/host/ehci-orion.c
+++ b/drivers/usb/host/ehci-orion.c
@@ -182,8 +182,9 @@ static int ehci_orion_drv_probe(struct platform_device *pdev)
182 */ 182 */
183 if (!pdev->dev.dma_mask) 183 if (!pdev->dev.dma_mask)
184 pdev->dev.dma_mask = &pdev->dev.coherent_dma_mask; 184 pdev->dev.dma_mask = &pdev->dev.coherent_dma_mask;
185 if (!pdev->dev.coherent_dma_mask) 185 err = dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32));
186 pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32); 186 if (err)
187 goto err1;
187 188
188 if (!request_mem_region(res->start, resource_size(res), 189 if (!request_mem_region(res->start, resource_size(res),
189 ehci_orion_hc_driver.description)) { 190 ehci_orion_hc_driver.description)) {
diff --git a/drivers/usb/host/ehci-platform.c b/drivers/usb/host/ehci-platform.c
index f6b790ca8cf2..5b0cd2d5f9a6 100644
--- a/drivers/usb/host/ehci-platform.c
+++ b/drivers/usb/host/ehci-platform.c
@@ -78,7 +78,7 @@ static int ehci_platform_probe(struct platform_device *dev)
78 struct resource *res_mem; 78 struct resource *res_mem;
79 struct usb_ehci_pdata *pdata; 79 struct usb_ehci_pdata *pdata;
80 int irq; 80 int irq;
81 int err = -ENOMEM; 81 int err;
82 82
83 if (usb_disabled()) 83 if (usb_disabled())
84 return -ENODEV; 84 return -ENODEV;
@@ -91,8 +91,9 @@ static int ehci_platform_probe(struct platform_device *dev)
91 dev->dev.platform_data = &ehci_platform_defaults; 91 dev->dev.platform_data = &ehci_platform_defaults;
92 if (!dev->dev.dma_mask) 92 if (!dev->dev.dma_mask)
93 dev->dev.dma_mask = &dev->dev.coherent_dma_mask; 93 dev->dev.dma_mask = &dev->dev.coherent_dma_mask;
94 if (!dev->dev.coherent_dma_mask) 94 err = dma_set_coherent_mask(&dev->dev, DMA_BIT_MASK(32));
95 dev->dev.coherent_dma_mask = DMA_BIT_MASK(32); 95 if (err)
96 return err;
96 97
97 pdata = dev_get_platdata(&dev->dev); 98 pdata = dev_get_platdata(&dev->dev);
98 99
diff --git a/drivers/usb/host/ehci-s5p.c b/drivers/usb/host/ehci-s5p.c
index 7c3de95c7054..10d6a2e307e1 100644
--- a/drivers/usb/host/ehci-s5p.c
+++ b/drivers/usb/host/ehci-s5p.c
@@ -91,8 +91,9 @@ static int s5p_ehci_probe(struct platform_device *pdev)
91 */ 91 */
92 if (!pdev->dev.dma_mask) 92 if (!pdev->dev.dma_mask)
93 pdev->dev.dma_mask = &pdev->dev.coherent_dma_mask; 93 pdev->dev.dma_mask = &pdev->dev.coherent_dma_mask;
94 if (!pdev->dev.coherent_dma_mask) 94 err = dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32));
95 pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32); 95 if (err)
96 return err;
96 97
97 s5p_setup_vbus_gpio(pdev); 98 s5p_setup_vbus_gpio(pdev);
98 99
diff --git a/drivers/usb/host/ehci-spear.c b/drivers/usb/host/ehci-spear.c
index 1cf0adba3fc8..6839e1504db5 100644
--- a/drivers/usb/host/ehci-spear.c
+++ b/drivers/usb/host/ehci-spear.c
@@ -83,8 +83,9 @@ static int spear_ehci_hcd_drv_probe(struct platform_device *pdev)
83 */ 83 */
84 if (!pdev->dev.dma_mask) 84 if (!pdev->dev.dma_mask)
85 pdev->dev.dma_mask = &pdev->dev.coherent_dma_mask; 85 pdev->dev.dma_mask = &pdev->dev.coherent_dma_mask;
86 if (!pdev->dev.coherent_dma_mask) 86 retval = dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32));
87 pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32); 87 if (retval)
88 goto fail;
88 89
89 usbh_clk = devm_clk_get(&pdev->dev, NULL); 90 usbh_clk = devm_clk_get(&pdev->dev, NULL);
90 if (IS_ERR(usbh_clk)) { 91 if (IS_ERR(usbh_clk)) {
diff --git a/drivers/usb/host/ehci-tegra.c b/drivers/usb/host/ehci-tegra.c
index 78fa76da3324..3d9ee43ef2d7 100644
--- a/drivers/usb/host/ehci-tegra.c
+++ b/drivers/usb/host/ehci-tegra.c
@@ -364,8 +364,9 @@ static int tegra_ehci_probe(struct platform_device *pdev)
364 */ 364 */
365 if (!pdev->dev.dma_mask) 365 if (!pdev->dev.dma_mask)
366 pdev->dev.dma_mask = &pdev->dev.coherent_dma_mask; 366 pdev->dev.dma_mask = &pdev->dev.coherent_dma_mask;
367 if (!pdev->dev.coherent_dma_mask) 367 err = dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32));
368 pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32); 368 if (err)
369 return err;
369 370
370 hcd = usb_create_hcd(&tegra_ehci_hc_driver, &pdev->dev, 371 hcd = usb_create_hcd(&tegra_ehci_hc_driver, &pdev->dev,
371 dev_name(&pdev->dev)); 372 dev_name(&pdev->dev));
diff --git a/drivers/usb/host/ohci-at91.c b/drivers/usb/host/ohci-at91.c
index caa3764a3407..eb7a2cb26419 100644
--- a/drivers/usb/host/ohci-at91.c
+++ b/drivers/usb/host/ohci-at91.c
@@ -524,7 +524,7 @@ MODULE_DEVICE_TABLE(of, at91_ohci_dt_ids);
524static int ohci_at91_of_init(struct platform_device *pdev) 524static int ohci_at91_of_init(struct platform_device *pdev)
525{ 525{
526 struct device_node *np = pdev->dev.of_node; 526 struct device_node *np = pdev->dev.of_node;
527 int i, gpio; 527 int i, gpio, ret;
528 enum of_gpio_flags flags; 528 enum of_gpio_flags flags;
529 struct at91_usbh_data *pdata; 529 struct at91_usbh_data *pdata;
530 u32 ports; 530 u32 ports;
@@ -538,8 +538,9 @@ static int ohci_at91_of_init(struct platform_device *pdev)
538 */ 538 */
539 if (!pdev->dev.dma_mask) 539 if (!pdev->dev.dma_mask)
540 pdev->dev.dma_mask = &pdev->dev.coherent_dma_mask; 540 pdev->dev.dma_mask = &pdev->dev.coherent_dma_mask;
541 if (!pdev->dev.coherent_dma_mask) 541 ret = dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32));
542 pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32); 542 if (ret)
543 return ret;
543 544
544 pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL); 545 pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL);
545 if (!pdata) 546 if (!pdata)
diff --git a/drivers/usb/host/ohci-exynos.c b/drivers/usb/host/ohci-exynos.c
index dc6ee9adacf5..ed685cbd5892 100644
--- a/drivers/usb/host/ohci-exynos.c
+++ b/drivers/usb/host/ohci-exynos.c
@@ -116,8 +116,9 @@ static int exynos_ohci_probe(struct platform_device *pdev)
116 */ 116 */
117 if (!pdev->dev.dma_mask) 117 if (!pdev->dev.dma_mask)
118 pdev->dev.dma_mask = &pdev->dev.coherent_dma_mask; 118 pdev->dev.dma_mask = &pdev->dev.coherent_dma_mask;
119 if (!pdev->dev.coherent_dma_mask) 119 err = dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32));
120 pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32); 120 if (err)
121 return err;
121 122
122 exynos_ohci = devm_kzalloc(&pdev->dev, sizeof(struct exynos_ohci_hcd), 123 exynos_ohci = devm_kzalloc(&pdev->dev, sizeof(struct exynos_ohci_hcd),
123 GFP_KERNEL); 124 GFP_KERNEL);
diff --git a/drivers/usb/host/ohci-nxp.c b/drivers/usb/host/ohci-nxp.c
index 7d7d507d54e8..5f82db409d65 100644
--- a/drivers/usb/host/ohci-nxp.c
+++ b/drivers/usb/host/ohci-nxp.c
@@ -226,8 +226,10 @@ static int usb_hcd_nxp_probe(struct platform_device *pdev)
226 return -EPROBE_DEFER; 226 return -EPROBE_DEFER;
227 } 227 }
228 228
229 pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32);
230 pdev->dev.dma_mask = &pdev->dev.coherent_dma_mask; 229 pdev->dev.dma_mask = &pdev->dev.coherent_dma_mask;
230 ret = dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32));
231 if (ret)
232 goto fail_disable;
231 233
232 dev_dbg(&pdev->dev, "%s: " DRIVER_DESC " (nxp)\n", hcd_name); 234 dev_dbg(&pdev->dev, "%s: " DRIVER_DESC " (nxp)\n", hcd_name);
233 if (usb_disabled()) { 235 if (usb_disabled()) {
diff --git a/drivers/usb/host/ohci-octeon.c b/drivers/usb/host/ohci-octeon.c
index 342dc7e543b8..ac1dea12a1a7 100644
--- a/drivers/usb/host/ohci-octeon.c
+++ b/drivers/usb/host/ohci-octeon.c
@@ -127,8 +127,10 @@ static int ohci_octeon_drv_probe(struct platform_device *pdev)
127 } 127 }
128 128
129 /* Ohci is a 32-bit device. */ 129 /* Ohci is a 32-bit device. */
130 pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32);
131 pdev->dev.dma_mask = &pdev->dev.coherent_dma_mask; 130 pdev->dev.dma_mask = &pdev->dev.coherent_dma_mask;
131 ret = dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32));
132 if (ret)
133 return ret;
132 134
133 hcd = usb_create_hcd(&ohci_octeon_hc_driver, &pdev->dev, "octeon"); 135 hcd = usb_create_hcd(&ohci_octeon_hc_driver, &pdev->dev, "octeon");
134 if (!hcd) 136 if (!hcd)
diff --git a/drivers/usb/host/ohci-omap3.c b/drivers/usb/host/ohci-omap3.c
index a09af26f69ed..664f5dc40939 100644
--- a/drivers/usb/host/ohci-omap3.c
+++ b/drivers/usb/host/ohci-omap3.c
@@ -132,7 +132,7 @@ static int ohci_hcd_omap3_probe(struct platform_device *pdev)
132 struct usb_hcd *hcd = NULL; 132 struct usb_hcd *hcd = NULL;
133 void __iomem *regs = NULL; 133 void __iomem *regs = NULL;
134 struct resource *res; 134 struct resource *res;
135 int ret = -ENODEV; 135 int ret;
136 int irq; 136 int irq;
137 137
138 if (usb_disabled()) 138 if (usb_disabled())
@@ -168,9 +168,11 @@ static int ohci_hcd_omap3_probe(struct platform_device *pdev)
168 */ 168 */
169 if (!dev->dma_mask) 169 if (!dev->dma_mask)
170 dev->dma_mask = &dev->coherent_dma_mask; 170 dev->dma_mask = &dev->coherent_dma_mask;
171 if (!dev->coherent_dma_mask) 171 ret = dma_set_coherent_mask(dev, DMA_BIT_MASK(32));
172 dev->coherent_dma_mask = DMA_BIT_MASK(32); 172 if (ret)
173 goto err_io;
173 174
175 ret = -ENODEV;
174 hcd = usb_create_hcd(&ohci_omap3_hc_driver, dev, 176 hcd = usb_create_hcd(&ohci_omap3_hc_driver, dev,
175 dev_name(dev)); 177 dev_name(dev));
176 if (!hcd) { 178 if (!hcd) {
diff --git a/drivers/usb/host/ohci-pxa27x.c b/drivers/usb/host/ohci-pxa27x.c
index 93371a235e82..74696ae29aa6 100644
--- a/drivers/usb/host/ohci-pxa27x.c
+++ b/drivers/usb/host/ohci-pxa27x.c
@@ -287,6 +287,7 @@ static int ohci_pxa_of_init(struct platform_device *pdev)
287 struct device_node *np = pdev->dev.of_node; 287 struct device_node *np = pdev->dev.of_node;
288 struct pxaohci_platform_data *pdata; 288 struct pxaohci_platform_data *pdata;
289 u32 tmp; 289 u32 tmp;
290 int ret;
290 291
291 if (!np) 292 if (!np)
292 return 0; 293 return 0;
@@ -297,8 +298,9 @@ static int ohci_pxa_of_init(struct platform_device *pdev)
297 */ 298 */
298 if (!pdev->dev.dma_mask) 299 if (!pdev->dev.dma_mask)
299 pdev->dev.dma_mask = &pdev->dev.coherent_dma_mask; 300 pdev->dev.dma_mask = &pdev->dev.coherent_dma_mask;
300 if (!pdev->dev.coherent_dma_mask) 301 ret = dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32));
301 pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32); 302 if (ret)
303 return ret;
302 304
303 pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL); 305 pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL);
304 if (!pdata) 306 if (!pdata)
diff --git a/drivers/usb/host/ohci-spear.c b/drivers/usb/host/ohci-spear.c
index cc9dd9e4f05e..195a0a121107 100644
--- a/drivers/usb/host/ohci-spear.c
+++ b/drivers/usb/host/ohci-spear.c
@@ -113,8 +113,9 @@ static int spear_ohci_hcd_drv_probe(struct platform_device *pdev)
113 */ 113 */
114 if (!pdev->dev.dma_mask) 114 if (!pdev->dev.dma_mask)
115 pdev->dev.dma_mask = &pdev->dev.coherent_dma_mask; 115 pdev->dev.dma_mask = &pdev->dev.coherent_dma_mask;
116 if (!pdev->dev.coherent_dma_mask) 116 retval = dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32));
117 pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32); 117 if (retval)
118 goto fail;
118 119
119 usbh_clk = devm_clk_get(&pdev->dev, NULL); 120 usbh_clk = devm_clk_get(&pdev->dev, NULL);
120 if (IS_ERR(usbh_clk)) { 121 if (IS_ERR(usbh_clk)) {
diff --git a/drivers/usb/host/uhci-platform.c b/drivers/usb/host/uhci-platform.c
index d033a0ec7f0d..048912d4819c 100644
--- a/drivers/usb/host/uhci-platform.c
+++ b/drivers/usb/host/uhci-platform.c
@@ -77,8 +77,9 @@ static int uhci_hcd_platform_probe(struct platform_device *pdev)
77 */ 77 */
78 if (!pdev->dev.dma_mask) 78 if (!pdev->dev.dma_mask)
79 pdev->dev.dma_mask = &pdev->dev.coherent_dma_mask; 79 pdev->dev.dma_mask = &pdev->dev.coherent_dma_mask;
80 if (!pdev->dev.coherent_dma_mask) 80 ret = dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32));
81 pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32); 81 if (ret)
82 return ret;
82 83
83 hcd = usb_create_hcd(&uhci_platform_hc_driver, &pdev->dev, 84 hcd = usb_create_hcd(&uhci_platform_hc_driver, &pdev->dev,
84 pdev->name); 85 pdev->name);