mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Peng Fan <peng.fan@nxp.com>
To: hch@lst.de, m.szyprowski@samsung.com, robin.murphy@arm.com,
	gregkh@linuxfoundation.org, robh+dt@kernel.org,
	frowand.list@gmail.com
Cc: iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org,
	devicetree@vger.kernel.org, van.freenix@gmail.com,
	Peng Fan <peng.fan@nxp.com>
Subject: [RFC 1/2] of: reserved_mem: check return value of_dma_configure
Date: Sun, 26 Nov 2017 21:13:45 +0800	[thread overview]
Message-ID: <20171126131346.12532-1-peng.fan@nxp.com> (raw)

In commit <7b07cbefb6>("iommu: of: Handle IOMMU lookup failure
with deferred probing or error"), there is possibility that
of_dma_configure may fail. So in of_reserved_mem_device_init_by_idx,
also need to propagate the return value of_dma_configure to caller,
when need to use reserved memory for a device which needs iommu.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
 drivers/of/of_reserved_mem.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/of/of_reserved_mem.c b/drivers/of/of_reserved_mem.c
index 22b75c82e377..61523819b50e 100644
--- a/drivers/of/of_reserved_mem.c
+++ b/drivers/of/of_reserved_mem.c
@@ -357,9 +357,12 @@ int of_reserved_mem_device_init_by_idx(struct device *dev,
 		/* ensure that dma_ops is set for virtual devices
 		 * using reserved memory
 		 */
-		of_dma_configure(dev, np);
-
-		dev_info(dev, "assigned reserved memory node %s\n", rmem->name);
+		ret = of_dma_configure(dev, np);
+		if (ret)
+			of_reserved_mem_device_release(dev);
+		else
+			dev_info(dev, "assigned reserved memory node %s\n",
+				 rmem->name);
 	} else {
 		kfree(rd);
 	}
-- 
2.14.1

             reply	other threads:[~2017-11-26 13:14 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-26 13:13 Peng Fan [this message]
2017-11-26 13:13 ` [RFC 2/2] drivers: dma-mapping: parse per device reserved mem at probe time Peng Fan
2017-11-27  8:31   ` Marek Szyprowski
2017-11-27  8:37     ` Peng Fan
2017-11-27  8:44       ` Marek Szyprowski
2017-11-27  9:04         ` Peng Fan
2017-12-07 12:01           ` Marek Szyprowski
2017-11-27  4:15 ` [RFC 1/2] of: reserved_mem: check return value of_dma_configure Peng Fan

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=20171126131346.12532-1-peng.fan@nxp.com \
    --to=peng.fan@nxp.com \
    --cc=devicetree@vger.kernel.org \
    --cc=frowand.list@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=hch@lst.de \
    --cc=iommu@lists.linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=m.szyprowski@samsung.com \
    --cc=robh+dt@kernel.org \
    --cc=robin.murphy@arm.com \
    --cc=van.freenix@gmail.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®