From: Fabio Baltieri <fabio.baltieri@linaro.org>
To: Felipe Balbi <balbi@ti.com>
Cc: Linus Walleij <linus.walleij@linaro.org>,
linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org,
Virupax Sadashivpetimath
<virupax.sadashivpetimath@stericsson.com>,
Fabio Baltieri <fabio.baltieri@linaro.org>
Subject: [PATCH 1/5] usb: musb: ux500_dma: add missing MEM resource check
Date: Thu, 28 Feb 2013 11:38:50 +0100 [thread overview]
Message-ID: <1362047934-22337-2-git-send-email-fabio.baltieri@linaro.org> (raw)
In-Reply-To: <1362047934-22337-1-git-send-email-fabio.baltieri@linaro.org>
From: Virupax Sadashivpetimath <virupax.sadashivpetimath@stericsson.com>
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>
---
drivers/usb/musb/ux500_dma.c | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/drivers/usb/musb/ux500_dma.c b/drivers/usb/musb/ux500_dma.c
index 360c99c..6e3db71 100644
--- a/drivers/usb/musb/ux500_dma.c
+++ b/drivers/usb/musb/ux500_dma.c
@@ -372,12 +372,17 @@ struct dma_controller *dma_controller_create(struct musb *musb,
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 +394,9 @@ struct dma_controller *dma_controller_create(struct musb *musb,
controller->controller.is_compatible = ux500_dma_is_compatible;
return &controller->controller;
+
+plat_get_fail:
+ kfree(controller);
+kzalloc_fail:
+ return NULL;
}
--
1.8.1.3
next prev parent reply other threads:[~2013-02-28 10:39 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-02-28 10:38 [PATCH 0/5] musb-ux500 and ab8500-usb updates Fabio Baltieri
2013-02-28 10:38 ` Fabio Baltieri [this message]
2013-02-28 10:38 ` [PATCH 2/5] usb: musb: ux500: implement musb_set_vbus Fabio Baltieri
2013-02-28 10:38 ` [PATCH 3/5] usb: musb: ux500: add otg notifier support Fabio Baltieri
2013-03-04 14:38 ` Felipe Balbi
2013-03-06 1:40 ` Fabio Baltieri
2013-03-06 8:54 ` Felipe Balbi
2013-03-07 1:58 ` Fabio Baltieri
2013-03-07 8:57 ` Fabio Baltieri
2013-03-07 9:10 ` Fabio Baltieri
2013-03-07 10:44 ` Felipe Balbi
2013-02-28 10:38 ` [PATCH 4/5] usb: otg: ab8500-usb: drop support for ab8500 pre v2.0 Fabio Baltieri
2013-02-28 10:38 ` [PATCH 5/5] usb: otg: ab8500-usb: update irq handling code Fabio Baltieri
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1362047934-22337-2-git-send-email-fabio.baltieri@linaro.org \
--to=fabio.baltieri@linaro.org \
--cc=balbi@ti.com \
--cc=linus.walleij@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=virupax.sadashivpetimath@stericsson.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®