Skip to contentSkip to conversation

amdgpu/dc: fix more indentation warnings

PATCH In review Ernst Sjöstrand 2 participants 4 messages Nov 7, 2017 2 messages not in the archive

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/3 amdgpu/dc: fix more indentation warnings

More "warn: inconsistent indenting" fixes from smatch.

---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c              | 10 +++++-----
 .../gpu/drm/amd/display/dc/i2caux/dce110/aux_engine_dce110.c   |  2 +-
 2 files changed, 6 insertions(+), 6 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +5 -5
index 67cad46f9f15..e6bfa9f30900 100644
@@ -517,7 +517,7 @@ static int detect_mst_link_for_all_connectors(struct drm_device *dev)
 	drm_modeset_lock(&dev->mode_config.connection_mutex, NULL);
 
 	list_for_each_entry(connector, &dev->mode_config.connector_list, head) {
-		   aconnector = to_amdgpu_dm_connector(connector);
+		aconnector = to_amdgpu_dm_connector(connector);
 		if (aconnector->dc_link->type == dc_connection_mst_branch) {
 			DRM_DEBUG_DRIVER("DM_MST: starting TM on aconnector: %p [id: %d]\n",
 					aconnector, aconnector->base.base.id);
@@ -4754,10 +4754,10 @@ static int amdgpu_dm_atomic_check(struct drm_device *dev,
 		goto fail;
 	}
 
-	 /* Run this here since we want to validate the streams we created */
-	 ret = drm_atomic_helper_check_planes(dev, state);
-	 if (ret)
-		 goto fail;
+	/* Run this here since we want to validate the streams we created */
+	ret = drm_atomic_helper_check_planes(dev, state);
+	if (ret)
+		goto fail;
 
 	/* Check scaling and underscan changes*/
 	/*TODO Removed scaling changes validation due to inability to commit
drivers/gpu/drm/amd/display/dc/i2caux/dce110/aux_engine_dce110.c +1 -1
index 0c4bbc10510d..81f9f3e34c10 100644
@@ -318,7 +318,7 @@ static void process_channel_reply(
 				REG_GET(AUX_SW_DATA,
 						AUX_SW_DATA, &aux_sw_data_val);
 
-				 reply->data[i] = aux_sw_data_val;
+				reply->data[i] = aux_sw_data_val;
 				++i;
 			}
 
Signature · 6 lines
2.14.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 20171107200659.21094-1-ernstp-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org

#2 lore raw

PATCH v2 2/3 amdgpu/dc: Fix potential null dereferences in amdgpu_dm.c

---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 9 +++++++++
 1 file changed, 9 insertions(+)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +9 -0
index e6bfa9f30900..218fb8ba750c 100644
@@ -2413,6 +2413,8 @@ dm_crtc_duplicate_state(struct drm_crtc *crtc)
 		return NULL;
 
 	state = kzalloc(sizeof(*state), GFP_KERNEL);
+	if (!state)
+		return NULL;
 
 	__drm_atomic_helper_crtc_duplicate_state(crtc, &state->base);
 
@@ -3443,6 +3445,8 @@ create_i2c(struct ddc_service *ddc_service,
 	struct amdgpu_i2c_adapter *i2c;
 
 	i2c = kzalloc(sizeof(struct amdgpu_i2c_adapter), GFP_KERNEL);
+	if (!i2c)
+		return NULL;
 	i2c->base.owner = THIS_MODULE;
 	i2c->base.class = I2C_CLASS_DDC;
 	i2c->base.dev.parent = &adev->pdev->dev;
@@ -3473,6 +3477,11 @@ static int amdgpu_dm_connector_init(struct amdgpu_display_manager *dm,
 	DRM_DEBUG_DRIVER("%s()\n", __func__);
 
 	i2c = create_i2c(link->ddc, link->link_index, &res);
+	if (!i2c) {
+		DRM_ERROR("Failed to create i2c adapter data\n");
+		return -ENOMEM;
+	}
+
 	aconnector->i2c = i2c;
 	res = i2c_add_adapter(&i2c->base);
 
Signature · 6 lines
2.14.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#3 lore raw

PATCH v2 3/3 amdgpu/dc: Fix missing null checks in amdgpu_dm.c

In reply to a message not in the archive

From smatch:
error: we previously assumed X could be null

---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +12 -5
index 218fb8ba750c..2ba5d9bddd6f 100644
@@ -430,10 +430,12 @@ static int amdgpu_dm_init(struct amdgpu_device *adev)
 	/* Display Core create. */
 	adev->dm.dc = dc_create(&init_data);
 
-	if (adev->dm.dc)
+	if (adev->dm.dc) {
 		DRM_INFO("Display Core initialized!\n");
-	else
+	} else {
 		DRM_INFO("Display Core failed to initialize!\n");
+		goto error;
+	}
 
 	INIT_WORK(&adev->dm.mst_hotplug_work, hotplug_notify_work_func);
 
@@ -2263,7 +2265,7 @@ decide_crtc_timing_for_drm_display_mode(struct drm_display_mode *drm_mode,
 	}
 }
 
-static void create_fake_sink(struct amdgpu_dm_connector *aconnector)
+static int create_fake_sink(struct amdgpu_dm_connector *aconnector)
 {
 	struct dc_sink *sink = NULL;
 	struct dc_sink_init_data sink_init_data = { 0 };
@@ -2272,14 +2274,18 @@ static void create_fake_sink(struct amdgpu_dm_connector *aconnector)
 	sink_init_data.sink_signal = aconnector->dc_link->connector_signal;
 
 	sink = dc_sink_create(&sink_init_data);
-	if (!sink)
+	if (!sink) {
 		DRM_ERROR("Failed to create sink!\n");
+		return -ENOMEM;
+	}
 
 	sink->sink_signal = SIGNAL_TYPE_VIRTUAL;
 	aconnector->fake_enable = true;
 
 	aconnector->dc_sink = sink;
 	aconnector->dc_link->local_sink = sink;
+
+	return 0;
 }
 
 static struct dc_stream_state *
@@ -2313,7 +2319,8 @@ create_stream_for_sink(struct amdgpu_dm_connector *aconnector,
 		if (aconnector->mst_port)
 			goto stream_create_fail;
 
-		create_fake_sink(aconnector);
+		if (create_fake_sink(aconnector))
+			goto stream_create_fail;
 	}
 
 	stream = dc_create_stream_for_sink(aconnector->dc_sink);
Signature · 6 lines
2.14.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 20171107200659.21094-3-ernstp-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org

Reviewed-by
#5 lore raw

Re: [PATCH v2 3/3] amdgpu/dc: Fix missing null checks in amdgpu_dm.c

Quoted 4 lines · Ernst Sjöstrand

From smatch:
error: we previously assumed X could be null

Entire patchset is

Harry

Quoted 54 lines
---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +10 -4
index 218fb8ba750c..2ba5d9bddd6f 100644
@@ -430,10 +430,12 @@ static int amdgpu_dm_init(struct amdgpu_device *adev)
 	/* Display Core create. */
 	adev->dm.dc = dc_create(&init_data);
 
-	if (adev->dm.dc)
+	if (adev->dm.dc) {
 		DRM_INFO("Display Core initialized!\n");
-	else
+	} else {
 		DRM_INFO("Display Core failed to initialize!\n");
+		goto error;
+	}
 
 	INIT_WORK(&adev->dm.mst_hotplug_work, hotplug_notify_work_func);
 
@@ -2263,7 +2265,7 @@ decide_crtc_timing_for_drm_display_mode(struct drm_display_mode *drm_mode,
 	}
 }
 
-static void create_fake_sink(struct amdgpu_dm_connector *aconnector)
+static int create_fake_sink(struct amdgpu_dm_connector *aconnector)
 {
 	struct dc_sink *sink = NULL;
 	struct dc_sink_init_data sink_init_data = { 0 };
@@ -2272,14 +2274,18 @@ static void create_fake_sink(struct amdgpu_dm_connector *aconnector)
 	sink_init_data.sink_signal = aconnector->dc_link->connector_signal;
 
 	sink = dc_sink_create(&sink_init_data);
-	if (!sink)
+	if (!sink) {
 		DRM_ERROR("Failed to create sink!\n");
+		return -ENOMEM;
+	}
 
 	sink->sink_signal = SIGNAL_TYPE_VIRTUAL;
 	aconnector->fake_enable = true;
 
 	aconnector->dc_sink = sink;
 	aconnector->dc_link->local_sink = sink;
+
+	return 0;
 }
 
 static struct dc_stream_state *

drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c create_stream_for_sink(struct amdgpu_dm_connector *aconnector, · line 2326

Quoted 9 lines
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +2 -1
@@ -2313,7 +2319,8 @@ create_stream_for_sink(struct amdgpu_dm_connector *aconnector,
 		if (aconnector->mst_port)
 			goto stream_create_fail;
 
-		create_fake_sink(aconnector);
+		if (create_fake_sink(aconnector))
+			goto stream_create_fail;
 	}
 
 	stream = dc_create_stream_for_sink(aconnector->dc_sink);

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx