Skip to content

Commit

Permalink
iommu/mediatek: Check for NULL instead of IS_ERR()
Browse files Browse the repository at this point in the history
of_platform_device_create() returns NULL on error, it never returns
error pointers.

Fixes: 0df4fab ('iommu/mediatek: Add mt8173 IOMMU driver')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Joerg Roedel <jroedel@suse.de>
  • Loading branch information
Dan Carpenter authored and Joerg Roedel committed Mar 2, 2016
1 parent 0b6c0ad commit 3189e49
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions drivers/iommu/mtk_iommu.c
Original file line number Diff line number Diff line change
Expand Up @@ -627,7 +627,7 @@ static int mtk_iommu_probe(struct platform_device *pdev)
plarbdev = of_platform_device_create(
larbnode, NULL,
platform_bus_type.dev_root);
if (IS_ERR(plarbdev))
if (!plarbdev)
return -EPROBE_DEFER;
}
data->smi_imu.larb_imu[i].dev = &plarbdev->dev;
Expand Down Expand Up @@ -720,8 +720,8 @@ static int mtk_iommu_init_fn(struct device_node *np)
struct platform_device *pdev;

pdev = of_platform_device_create(np, NULL, platform_bus_type.dev_root);
if (IS_ERR(pdev))
return PTR_ERR(pdev);
if (!pdev)
return -ENOMEM;

ret = platform_driver_register(&mtk_iommu_driver);
if (ret) {
Expand Down

0 comments on commit 3189e49

Please sign in to comment.