linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] dma: of-dma: return error when 'dma-cells' not found
@ 2013-03-05  9:25 Padmavathi Venna
  2013-03-05  9:25 ` [PATCH V2] DMA: PL330: Add check if device tree compatible Padmavathi Venna
  2013-03-05  9:43 ` [PATCH] dma: of-dma: return error when 'dma-cells' not found Rob Herring
  0 siblings, 2 replies; 12+ messages in thread
From: Padmavathi Venna @ 2013-03-05  9:25 UTC (permalink / raw)
  To: linux-arm-kernel

This patch returns error when 'dma-cells' property not found
in the corresponding device node. With out this change there
is a crash in the generic dma incompatible platforms.

Signed-off-by: Padmavathi Venna <padma.v@samsung.com>
---

Based on Vinod Koul next branch.

 drivers/dma/of-dma.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/drivers/dma/of-dma.c b/drivers/dma/of-dma.c
index 69d04d2..46aca0d 100644
--- a/drivers/dma/of-dma.c
+++ b/drivers/dma/of-dma.c
@@ -92,6 +92,7 @@ int of_dma_controller_register(struct device_node *np,
 				void *data)
 {
 	struct of_dma	*ofdma;
+	const	 __be32 *ip;
 	int		nbcells;
 
 	if (!np || !of_dma_xlate) {
@@ -103,7 +104,12 @@ int of_dma_controller_register(struct device_node *np,
 	if (!ofdma)
 		return -ENOMEM;
 
-	nbcells = be32_to_cpup(of_get_property(np, "#dma-cells", NULL));
+	ip = of_get_property(np, "#dma-cells", NULL);
+	if (!ip)
+		return -ENXIO;
+
+	nbcells = be32_to_cpup(ip);
+
 	if (!nbcells) {
 		pr_err("%s: #dma-cells property is missing or invalid\n",
 		       __func__);
-- 
1.7.4.4

^ permalink raw reply related	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2013-04-02  2:58 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-03-05  9:25 [PATCH] dma: of-dma: return error when 'dma-cells' not found Padmavathi Venna
2013-03-05  9:25 ` [PATCH V2] DMA: PL330: Add check if device tree compatible Padmavathi Venna
2013-03-13  5:36   ` Padma Venkat
2013-03-21  9:39   ` Vinod Koul
2013-04-01 13:13     ` Rob Herring
2013-04-01 18:21       ` Vinod Koul
2013-04-02  2:58         ` Padma Venkat
2013-03-05  9:43 ` [PATCH] dma: of-dma: return error when 'dma-cells' not found Rob Herring
2013-03-05 10:04   ` Padma Venkat
2013-03-05 10:15   ` Arnd Bergmann
2013-03-05 14:56     ` Rob Herring
2013-03-05 19:48       ` Arnd Bergmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).