UPSTREAM: iommu/rockchip: Don't feed NULL res pointers to devres
authorTomeu Vizoso <tomeu.vizoso@collabora.com>
Mon, 21 Mar 2016 11:00:23 +0000 (12:00 +0100)
committerHuang, Tao <huangtao@rock-chips.com>
Wed, 30 Nov 2016 06:10:39 +0000 (14:10 +0800)
If we do, devres prints a "invalid resource" string in the error
loglevel.

Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Reviewed-by: Javier Martinez Canillas <javier@osg.samsung.com>
Signed-off-by: Joerg Roedel <jroedel@suse.de>
(cherry picked from commit 8d7f2d84ed2d44b05e1ce88fa4b74886af46a139)

Change-Id: I3849bcaa4ceaea3247a8169b2a123a834011fbc5
Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
drivers/iommu/rockchip-iommu.c

index 650c7e42afe85d005c139df3399167edb08ad4cd..ce1ed0deb384e429343dd97702c33bc526c93b39 100644 (file)
@@ -1141,6 +1141,8 @@ static int rk_iommu_probe(struct platform_device *pdev)
 
        for (i = 0; i < num_res; i++) {
                res = platform_get_resource(pdev, IORESOURCE_MEM, i);
+               if (!res)
+                       continue;
                iommu->bases[i] = devm_ioremap_resource(&pdev->dev, res);
                if (IS_ERR(iommu->bases[i]))
                        continue;