diff options
Diffstat (limited to 'drivers/usb/musb/ux500_dma.c')
| -rw-r--r-- | drivers/usb/musb/ux500_dma.c | 24 | 
1 files changed, 18 insertions, 6 deletions
diff --git a/drivers/usb/musb/ux500_dma.c b/drivers/usb/musb/ux500_dma.c index 039e567dd3b..33812064114 100644 --- a/drivers/usb/musb/ux500_dma.c +++ b/drivers/usb/musb/ux500_dma.c @@ -1,7 +1,7 @@  /*   * drivers/usb/musb/ux500_dma.c   * - * U8500 and U5500 DMA support code + * U8500 DMA support code   *   * Copyright (C) 2009 STMicroelectronics   * Copyright (C) 2011 ST-Ericsson SA @@ -30,6 +30,7 @@  #include <linux/dma-mapping.h>  #include <linux/dmaengine.h>  #include <linux/pfn.h> +#include <linux/sizes.h>  #include <linux/platform_data/usb-musb-ux500.h>  #include "musb_core.h" @@ -56,7 +57,7 @@ struct ux500_dma_controller {  };  /* Work function invoked from DMA callback to handle rx transfers. */ -void ux500_dma_callback(void *private_data) +static void ux500_dma_callback(void *private_data)  {  	struct dma_channel *channel = private_data;  	struct ux500_dma_channel *ux500_channel = channel->private_data; @@ -93,8 +94,9 @@ static bool ux500_configure_channel(struct dma_channel *channel,  	struct musb *musb = ux500_channel->controller->private_data;  	dev_dbg(musb->controller, -		"packet_sz=%d, mode=%d, dma_addr=0x%x, len=%d is_tx=%d\n", -		packet_sz, mode, dma_addr, len, ux500_channel->is_tx); +		"packet_sz=%d, mode=%d, dma_addr=0x%llu, len=%d is_tx=%d\n", +		packet_sz, mode, (unsigned long long) dma_addr, +		len, ux500_channel->is_tx);  	ux500_channel->cur_len = len; @@ -191,7 +193,7 @@ static int ux500_dma_is_compatible(struct dma_channel *channel,  		u16 maxpacket, void *buf, u32 length)  {  	if ((maxpacket & 0x3)		|| -		((int)buf & 0x3)	|| +		((unsigned long int) buf & 0x3)	||  		(length < 512)		||  		(length & 0x3))  		return false; @@ -372,12 +374,17 @@ struct dma_controller *dma_controller_create(struct musb *musb, void __iomem *ba  	controller = kzalloc(sizeof(*controller), GFP_KERNEL);  	if (!controller) -		return NULL; +		goto kzalloc_fail;  	controller->private_data = musb;  	/* Save physical address for DMA controller. */  	iomem = platform_get_resource(pdev, IORESOURCE_MEM, 0); +	if (!iomem) { +		dev_err(musb->controller, "no memory resource defined\n"); +		goto plat_get_fail; +	} +  	controller->phy_base = (dma_addr_t) iomem->start;  	controller->controller.start = ux500_dma_controller_start; @@ -389,4 +396,9 @@ struct dma_controller *dma_controller_create(struct musb *musb, void __iomem *ba  	controller->controller.is_compatible = ux500_dma_is_compatible;  	return &controller->controller; + +plat_get_fail: +	kfree(controller); +kzalloc_fail: +	return NULL;  }  |