[PATCH] drm/rockchip: rgb: make connector a pointer in struct rockchip_rgb

Alex Bee knaerzche at gmail.com
Wed Sep 22 13:17:58 PDT 2021


As reported at [1] Coverity complains about an used value.

Let's make drm_connector a pointer in struct rockchip_rgb and "remove
redundant assignment of pointer connector".

[1] https://lkml.org/lkml/2021/9/22/432

Fixes: 2e87bf389e13 ("drm/rockchip: add DRM_BRIDGE_ATTACH_NO_CONNECTOR flag to drm_bridge_attach")
Addresses-Coverity: ("Unused value")
Reported-by: Colin Ian King <colin.king at canonical.com>
Signed-off-by: Alex Bee <knaerzche at gmail.com>
---
 drivers/gpu/drm/rockchip/rockchip_rgb.c | 18 ++++++++----------
 1 file changed, 8 insertions(+), 10 deletions(-)

diff --git a/drivers/gpu/drm/rockchip/rockchip_rgb.c b/drivers/gpu/drm/rockchip/rockchip_rgb.c
index 09be9678f2bd..fe932c26c3e0 100644
--- a/drivers/gpu/drm/rockchip/rockchip_rgb.c
+++ b/drivers/gpu/drm/rockchip/rockchip_rgb.c
@@ -28,7 +28,7 @@ struct rockchip_rgb {
 	struct drm_device *drm_dev;
 	struct drm_bridge *bridge;
 	struct drm_encoder encoder;
-	struct drm_connector connector;
+	struct drm_connector *connector;
 	int output_mode;
 };
 
@@ -82,7 +82,6 @@ struct rockchip_rgb *rockchip_rgb_init(struct device *dev,
 	int ret = 0, child_count = 0;
 	struct drm_panel *panel;
 	struct drm_bridge *bridge;
-	struct drm_connector *connector;
 
 	rgb = devm_kzalloc(dev, sizeof(*rgb), GFP_KERNEL);
 	if (!rgb)
@@ -150,17 +149,16 @@ struct rockchip_rgb *rockchip_rgb_init(struct device *dev,
 	if (ret)
 		goto err_free_encoder;
 
-	connector = &rgb->connector;
-	connector = drm_bridge_connector_init(rgb->drm_dev, encoder);
-	if (IS_ERR(connector)) {
+	rgb->connector = drm_bridge_connector_init(rgb->drm_dev, encoder);
+	if (IS_ERR(rgb->connector)) {
 		DRM_DEV_ERROR(drm_dev->dev,
 			      "failed to initialize bridge connector: %pe\n",
-			      connector);
-		ret = PTR_ERR(connector);
+			      rgb->connector);
+		ret = PTR_ERR(rgb->connector);
 		goto err_free_encoder;
 	}
 
-	ret = drm_connector_attach_encoder(connector, encoder);
+	ret = drm_connector_attach_encoder(rgb->connector, encoder);
 	if (ret < 0) {
 		DRM_DEV_ERROR(drm_dev->dev,
 			      "failed to attach encoder: %d\n", ret);
@@ -170,7 +168,7 @@ struct rockchip_rgb *rockchip_rgb_init(struct device *dev,
 	return rgb;
 
 err_free_connector:
-	drm_connector_cleanup(connector);
+	drm_connector_cleanup(rgb->connector);
 err_free_encoder:
 	drm_encoder_cleanup(encoder);
 	return ERR_PTR(ret);
@@ -180,7 +178,7 @@ EXPORT_SYMBOL_GPL(rockchip_rgb_init);
 void rockchip_rgb_fini(struct rockchip_rgb *rgb)
 {
 	drm_panel_bridge_remove(rgb->bridge);
-	drm_connector_cleanup(&rgb->connector);
+	drm_connector_cleanup(rgb->connector);
 	drm_encoder_cleanup(&rgb->encoder);
 }
 EXPORT_SYMBOL_GPL(rockchip_rgb_fini);
-- 
2.30.2




More information about the Linux-rockchip mailing list