From: Ondrej Jirman <megous@megous.com>
Date: Sun, 21 Nov 2021 17:00:09 +0100
Subject: [PATCH 24/36] media: rockchip: rga: Fix probe bugs

The check for dst_mmu_pages allocation failure was inverted.

rga_parse_dt is missing a error return, so if some of the resources
return DEFER_PROBE, probe will succeed without these resources.

Signed-off-by: Ondrej Jirman <megous@megous.com>
---
 drivers/media/platform/rockchip/rga/rga.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/media/platform/rockchip/rga/rga.c b/drivers/media/platform/rockchip/rga/rga.c
index 4de5e8d..82cc0c0 100644
--- a/drivers/media/platform/rockchip/rga/rga.c
+++ b/drivers/media/platform/rockchip/rga/rga.c
@@ -815,8 +815,10 @@ static int rga_probe(struct platform_device *pdev)
 	mutex_init(&rga->mutex);
 
 	ret = rga_parse_dt(rga);
-	if (ret)
+	if (ret) {
 		dev_err(&pdev->dev, "Unable to parse OF data\n");
+		return ret;
+	}
 
 	pm_runtime_enable(rga->dev);
 
@@ -892,7 +894,7 @@ static int rga_probe(struct platform_device *pdev)
 	}
 	rga->dst_mmu_pages =
 		(unsigned int *)__get_free_pages(GFP_KERNEL | __GFP_ZERO, 3);
-	if (rga->dst_mmu_pages) {
+	if (!rga->dst_mmu_pages) {
 		ret = -ENOMEM;
 		goto free_src_pages;
 	}