diff options
| -rw-r--r-- | drivers/iommu/omap-iommu.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/drivers/iommu/omap-iommu.c b/drivers/iommu/omap-iommu.c index b888b7a6dd4f..df579f8779cd 100644 --- a/drivers/iommu/omap-iommu.c +++ b/drivers/iommu/omap-iommu.c | |||
| @@ -26,6 +26,7 @@ | |||
| 26 | #include <linux/of.h> | 26 | #include <linux/of.h> |
| 27 | #include <linux/of_iommu.h> | 27 | #include <linux/of_iommu.h> |
| 28 | #include <linux/of_irq.h> | 28 | #include <linux/of_irq.h> |
| 29 | #include <linux/of_platform.h> | ||
| 29 | 30 | ||
| 30 | #include <asm/cacheflush.h> | 31 | #include <asm/cacheflush.h> |
| 31 | 32 | ||
| @@ -1244,6 +1245,7 @@ static int omap_iommu_add_device(struct device *dev) | |||
| 1244 | { | 1245 | { |
| 1245 | struct omap_iommu_arch_data *arch_data; | 1246 | struct omap_iommu_arch_data *arch_data; |
| 1246 | struct device_node *np; | 1247 | struct device_node *np; |
| 1248 | struct platform_device *pdev; | ||
| 1247 | 1249 | ||
| 1248 | /* | 1250 | /* |
| 1249 | * Allocate the archdata iommu structure for DT-based devices. | 1251 | * Allocate the archdata iommu structure for DT-based devices. |
| @@ -1258,13 +1260,19 @@ static int omap_iommu_add_device(struct device *dev) | |||
| 1258 | if (!np) | 1260 | if (!np) |
| 1259 | return 0; | 1261 | return 0; |
| 1260 | 1262 | ||
| 1263 | pdev = of_find_device_by_node(np); | ||
| 1264 | if (WARN_ON(!pdev)) { | ||
| 1265 | of_node_put(np); | ||
| 1266 | return -EINVAL; | ||
| 1267 | } | ||
| 1268 | |||
| 1261 | arch_data = kzalloc(sizeof(*arch_data), GFP_KERNEL); | 1269 | arch_data = kzalloc(sizeof(*arch_data), GFP_KERNEL); |
| 1262 | if (!arch_data) { | 1270 | if (!arch_data) { |
| 1263 | of_node_put(np); | 1271 | of_node_put(np); |
| 1264 | return -ENOMEM; | 1272 | return -ENOMEM; |
| 1265 | } | 1273 | } |
| 1266 | 1274 | ||
| 1267 | arch_data->name = kstrdup(dev_name(dev), GFP_KERNEL); | 1275 | arch_data->name = kstrdup(dev_name(&pdev->dev), GFP_KERNEL); |
| 1268 | dev->archdata.iommu = arch_data; | 1276 | dev->archdata.iommu = arch_data; |
| 1269 | 1277 | ||
| 1270 | of_node_put(np); | 1278 | of_node_put(np); |
