summaryrefslogtreecommitdiffstats
path: root/drivers/usb/dwc2/host.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/dwc2/host.c')
-rw-r--r--drivers/usb/dwc2/host.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/drivers/usb/dwc2/host.c b/drivers/usb/dwc2/host.c
index b5a51f5668..344f058be2 100644
--- a/drivers/usb/dwc2/host.c
+++ b/drivers/usb/dwc2/host.c
@@ -1,4 +1,4 @@
-// SPDX-License-Identifier: GPL-2.0+
+// SPDX-License-Identifier: GPL-2.0-or-later
#include <dma.h>
#include "dwc2.h"
@@ -169,10 +169,11 @@ static int transfer_chunk(struct dwc2 *dwc2, u8 hc,
int xfer_len, int *actual_len, int odd_frame)
{
uint32_t hctsiz, hcchar, sub;
- dma_addr_t dma_addr;
+ dma_addr_t dma_addr = 0;
int ret = 0;
- dma_addr = dma_map_single(dwc2->dev, buffer, xfer_len,
+ if (xfer_len)
+ dma_addr = dma_map_single(dwc2->dev, buffer, xfer_len,
in ? DMA_FROM_DEVICE : DMA_TO_DEVICE);
if (dma_mapping_error(dwc2->dev, dma_addr)) {
@@ -213,7 +214,8 @@ static int transfer_chunk(struct dwc2 *dwc2, u8 hc,
*actual_len = xfer_len;
exit:
- dma_unmap_single(dwc2->dev, dma_addr, xfer_len,
+ if (xfer_len)
+ dma_unmap_single(dwc2->dev, dma_addr, xfer_len,
in ? DMA_FROM_DEVICE : DMA_TO_DEVICE);
return ret;
@@ -614,7 +616,7 @@ static void dwc2_config_fifos(struct dwc2 *dwc2)
* @param regs Programming view of DWC2 controller
*
*/
-static void dwc2_core_host_init(struct device_d *dev,
+static void dwc2_core_host_init(struct device *dev,
struct dwc2 *dwc2)
{
uint32_t hcchar, hcfg, hprt0, hotgctl, usbcfg;
@@ -719,7 +721,7 @@ static void dwc2_core_host_init(struct device_d *dev,
static int dwc2_host_init(struct usb_host *host)
{
struct dwc2 *dwc2 = to_dwc2(host);
- struct device_d *dev = dwc2->dev;
+ struct device *dev = dwc2->dev;
uint32_t hprt0, gusbcfg;
int i, j;