Commit 3189e490 authored by Dan Carpenter's avatar Dan Carpenter Committed by Joerg Roedel

iommu/mediatek: Check for NULL instead of IS_ERR()

of_platform_device_create() returns NULL on error, it never returns
error pointers.

Fixes: 0df4fabe ('iommu/mediatek: Add mt8173 IOMMU driver')
Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarJoerg Roedel <jroedel@suse.de>
parent 0b6c0ad3
...@@ -627,7 +627,7 @@ static int mtk_iommu_probe(struct platform_device *pdev) ...@@ -627,7 +627,7 @@ static int mtk_iommu_probe(struct platform_device *pdev)
plarbdev = of_platform_device_create( plarbdev = of_platform_device_create(
larbnode, NULL, larbnode, NULL,
platform_bus_type.dev_root); platform_bus_type.dev_root);
if (IS_ERR(plarbdev)) if (!plarbdev)
return -EPROBE_DEFER; return -EPROBE_DEFER;
} }
data->smi_imu.larb_imu[i].dev = &plarbdev->dev; data->smi_imu.larb_imu[i].dev = &plarbdev->dev;
...@@ -720,8 +720,8 @@ static int mtk_iommu_init_fn(struct device_node *np) ...@@ -720,8 +720,8 @@ static int mtk_iommu_init_fn(struct device_node *np)
struct platform_device *pdev; struct platform_device *pdev;
pdev = of_platform_device_create(np, NULL, platform_bus_type.dev_root); pdev = of_platform_device_create(np, NULL, platform_bus_type.dev_root);
if (IS_ERR(pdev)) if (!pdev)
return PTR_ERR(pdev); return -ENOMEM;
ret = platform_driver_register(&mtk_iommu_driver); ret = platform_driver_register(&mtk_iommu_driver);
if (ret) { if (ret) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment