From: Rob Herring <robherring2@gmail.com>
To: linux-kernel@vger.kernel.org, devicetree-discuss@lists.ozlabs.org
Cc: Rob Herring <rob.herring@calxeda.com>,
Vinod Koul <vinod.koul@intel.com>, Dan Williams <djbw@fb.com>,
Grant Likely <grant.likely@secretlab.ca>
Subject: [PATCH 2/2] dma: of: allow for non-existent #dma-cells property
Date: Wed, 27 Feb 2013 18:57:58 -0600 [thread overview]
Message-ID: <1362013078-2213-2-git-send-email-robherring2@gmail.com> (raw)
In-Reply-To: <1362013078-2213-1-git-send-email-robherring2@gmail.com>
From: Rob Herring <rob.herring@calxeda.com>
Allow the #dma-cells property to be optional and default to 0. This fixes
a crash on Calxed highbank which has no clients and no #dma-cells property.
Also, the error check was pointless as be32_to_cpup causes a NULL ptr error
first before we get to the error check.
Signed-off-by: Rob Herring <rob.herring@calxeda.com>
Cc: Vinod Koul <vinod.koul@intel.com>
Cc: Dan Williams <djbw@fb.com>
Cc: Grant Likely <grant.likely@secretlab.ca>
---
drivers/dma/of-dma.c | 10 ++--------
1 file changed, 2 insertions(+), 8 deletions(-)
diff --git a/drivers/dma/of-dma.c b/drivers/dma/of-dma.c
index 69d04d2..e97a062 100644
--- a/drivers/dma/of-dma.c
+++ b/drivers/dma/of-dma.c
@@ -92,7 +92,7 @@ int of_dma_controller_register(struct device_node *np,
void *data)
{
struct of_dma *ofdma;
- int nbcells;
+ int nbcells = 0;
if (!np || !of_dma_xlate) {
pr_err("%s: not enough information provided\n", __func__);
@@ -103,13 +103,7 @@ 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) {
- pr_err("%s: #dma-cells property is missing or invalid\n",
- __func__);
- kfree(ofdma);
- return -EINVAL;
- }
+ of_property_read_u32(np, "#dma-cells", &nbcells);
ofdma->of_node = np;
ofdma->of_dma_nbcells = nbcells;
--
1.7.10.4
next prev parent reply other threads:[~2013-02-28 0:57 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-02-28 0:57 [PATCH 1/2] of: dma: make #dma-cells optional Rob Herring
2013-02-28 0:57 ` Rob Herring [this message]
[not found] ` <1362013078-2213-1-git-send-email-robherring2-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2013-02-28 1:33 ` Jon Hunter
[not found] ` <512EB3FD.2000207-l0cyMroinI0@public.gmane.org>
2013-02-28 1:43 ` Jon Hunter
2013-03-07 6:34 ` Vinod Koul
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=1362013078-2213-2-git-send-email-robherring2@gmail.com \
--to=robherring2@gmail.com \
--cc=devicetree-discuss@lists.ozlabs.org \
--cc=djbw@fb.com \
--cc=grant.likely@secretlab.ca \
--cc=linux-kernel@vger.kernel.org \
--cc=rob.herring@calxeda.com \
--cc=vinod.koul@intel.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;
as well as URLs for NNTP newsgroup(s).