All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC 1/2] of: reserved_mem: check return value of_dma_configure
@ 2017-11-26 13:13 ` Peng Fan
  0 siblings, 0 replies; 15+ messages in thread
From: Peng Fan @ 2017-11-26 13:13 UTC (permalink / raw)
  To: hch, m.szyprowski, robin.murphy, gregkh, robh+dt, frowand.list
  Cc: iommu, linux-kernel, devicetree, van.freenix, Peng Fan

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

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

end of thread, other threads:[~2017-12-07 12:01 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-26 13:13 [RFC 1/2] of: reserved_mem: check return value of_dma_configure Peng Fan
2017-11-26 13:13 ` Peng Fan
2017-11-26 13:13 ` [RFC 2/2] drivers: dma-mapping: parse per device reserved mem at probe time Peng Fan
2017-11-26 13:13   ` Peng Fan
2017-11-27  8:31   ` Marek Szyprowski
2017-11-27  8:31     ` Marek Szyprowski
2017-11-27  8:37     ` Peng Fan
2017-11-27  8:37       ` Peng Fan
2017-11-27  8:44       ` Marek Szyprowski
2017-11-27  8:44         ` Marek Szyprowski
2017-11-27  9:04         ` Peng Fan
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
2017-11-27  4:15   ` Peng Fan

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.