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 <padm...@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

--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to