aboutsummaryrefslogtreecommitdiff
path: root/drivers/dma/of-dma.c
diff options
context:
space:
mode:
authorMark Brown <broonie@sirena.org.uk>2013-06-14 12:08:35 +0100
committerMark Brown <broonie@sirena.org.uk>2013-06-14 12:08:35 +0100
commit017db6aba01656f754d034bf17c6fae0a76ca36e (patch)
treea3cf0fd4d94aaaa6d56013da1386bd71ca929e52 /drivers/dma/of-dma.c
parent964318b02e12781615db595075a29557f4302940 (diff)
parent4b73febd1ba302268aabe370de25601eaa884b25 (diff)
Merge branch 'tracking-linux-3.x.y' into merge-manifest
Diffstat (limited to 'drivers/dma/of-dma.c')
-rw-r--r--drivers/dma/of-dma.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/dma/of-dma.c b/drivers/dma/of-dma.c
index 69d04d28b1e..09c7ad13031 100644
--- a/drivers/dma/of-dma.c
+++ b/drivers/dma/of-dma.c
@@ -93,6 +93,7 @@ int of_dma_controller_register(struct device_node *np,
{
struct of_dma *ofdma;
int nbcells;
+ const __be32 *prop;
if (!np || !of_dma_xlate) {
pr_err("%s: not enough information provided\n", __func__);
@@ -103,8 +104,11 @@ int of_dma_controller_register(struct device_node *np,
if (!ofdma)
return -ENOMEM;
- nbcells = be32_to_cpup(of_get_property(np, "#dma-cells", NULL));
- if (!nbcells) {
+ prop = of_get_property(np, "#dma-cells", NULL);
+ if (prop)
+ nbcells = be32_to_cpup(prop);
+
+ if (!prop || !nbcells) {
pr_err("%s: #dma-cells property is missing or invalid\n",
__func__);
kfree(ofdma);