drm/rockchip: rgb: don't count non-existent devices when determining subdrivers
authorHeiko Stuebner <heiko.stuebner@theobroma-systems.com>
Tue, 21 Jan 2020 22:48:28 +0000 (23:48 +0100)
committerHeiko Stuebner <heiko@sntech.de>
Wed, 11 Mar 2020 08:44:14 +0000 (09:44 +0100)
rockchip_drm_endpoint_is_subdriver() may also return error codes.
For example if the target-node is in the disabled state, so no
platform-device is getting created for it.

In that case current code would count that as external rgb device,
which in turn would make probing the rockchip-drm device fail.

So only count the target as rgb device if the function actually
returns 0.

Signed-off-by: Heiko Stuebner <heiko.stuebner@theobroma-systems.com>
Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200121224828.4070067-1-heiko@sntech.de
drivers/gpu/drm/rockchip/rockchip_rgb.c

index 3e2484985955356b73d73cb454d7568fe81e7bb0..90784781e51596499677e95821c4c1a5e181b92d 100644 (file)
@@ -98,7 +98,8 @@ struct rockchip_rgb *rockchip_rgb_init(struct device *dev,
                if (of_property_read_u32(endpoint, "reg", &endpoint_id))
                        endpoint_id = 0;
 
-               if (rockchip_drm_endpoint_is_subdriver(endpoint) > 0)
+               /* if subdriver (> 0) or error case (< 0), ignore entry */
+               if (rockchip_drm_endpoint_is_subdriver(endpoint) != 0)
                        continue;
 
                child_count++;