diff options
author | Virupax Sadashivpetimath <virupax.sadashivpetimath@stericsson.com> | 2013-03-08 02:27:05 (GMT) |
---|---|---|
committer | Felipe Balbi <balbi@ti.com> | 2013-03-18 12:41:31 (GMT) |
commit | 399e0f4f00adbfdea2122c1daec0d4015f56cc7a (patch) | |
tree | d995ea72c4cece63d72d6180e2f3cd1062ceadd4 /drivers/usb/musb | |
parent | 9ee1c7fbeab5b671d3b63f2dd33ad48235efcfe8 (diff) | |
download | linux-399e0f4f00adbfdea2122c1daec0d4015f56cc7a.tar.xz |
usb: musb: ux500_dma: add missing MEM resource check
Fix dma_controller_create() fail path in case memory resource is
missing.
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Virupax Sadashivpetimath <virupax.sadashivpetimath@stericsson.com>
Signed-off-by: Fabio Baltieri <fabio.baltieri@linaro.org>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers/usb/musb')
-rw-r--r-- | drivers/usb/musb/ux500_dma.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/drivers/usb/musb/ux500_dma.c b/drivers/usb/musb/ux500_dma.c index c3a584c..2df9b7d 100644 --- a/drivers/usb/musb/ux500_dma.c +++ b/drivers/usb/musb/ux500_dma.c @@ -374,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; @@ -391,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; } |