diff options
| author | Harry Wentland <harry.wentland@amd.com> | 2017-10-20 08:28:59 -0400 |
|---|---|---|
| committer | Alex Deucher <alexander.deucher@amd.com> | 2017-11-02 13:02:20 -0400 |
| commit | cd8a2ae8dc08a92d4804a7adda645f1f8d1f7586 (patch) | |
| tree | efe08c35880a74343b177f44775a58d6bdfdc8bc | |
| parent | efa6a8b7ca0f1c6073a2ac7f5a02f8ea333daf92 (diff) | |
drm/amd/display: Use single fail label in init_drm_dev
No need for multiple labels as kfree will always do a NULL check
before freeing the memory.
Signed-off-by: Harry Wentland <harry.wentland@amd.com>
Reviewed-by: Bhawanpreet Lakha <Bhawanpreet.Lakha@amd.com>
Reviewed-by: Tony Cheng <Tony.Cheng@amd.com>
Acked-by: Harry Wentland <harry.wentland@amd.com>
Reviewed-by: Andrey Grodzovsky <andrey.grodzovsky@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
| -rw-r--r-- | drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c index 2df9f951b7e7..6eb7b32fb763 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | |||
| @@ -1335,7 +1335,7 @@ static int amdgpu_dm_initialize_drm_device(struct amdgpu_device *adev) | |||
| 1335 | 1335 | ||
| 1336 | if (!plane) { | 1336 | if (!plane) { |
| 1337 | DRM_ERROR("KMS: Failed to allocate plane\n"); | 1337 | DRM_ERROR("KMS: Failed to allocate plane\n"); |
| 1338 | goto fail_free_planes; | 1338 | goto fail; |
| 1339 | } | 1339 | } |
| 1340 | plane->base.type = mode_info->plane_type[i]; | 1340 | plane->base.type = mode_info->plane_type[i]; |
| 1341 | 1341 | ||
| @@ -1351,14 +1351,14 @@ static int amdgpu_dm_initialize_drm_device(struct amdgpu_device *adev) | |||
| 1351 | 1351 | ||
| 1352 | if (amdgpu_dm_plane_init(dm, mode_info->planes[i], possible_crtcs)) { | 1352 | if (amdgpu_dm_plane_init(dm, mode_info->planes[i], possible_crtcs)) { |
| 1353 | DRM_ERROR("KMS: Failed to initialize plane\n"); | 1353 | DRM_ERROR("KMS: Failed to initialize plane\n"); |
| 1354 | goto fail_free_planes; | 1354 | goto fail; |
| 1355 | } | 1355 | } |
| 1356 | } | 1356 | } |
| 1357 | 1357 | ||
| 1358 | for (i = 0; i < dm->dc->caps.max_streams; i++) | 1358 | for (i = 0; i < dm->dc->caps.max_streams; i++) |
| 1359 | if (amdgpu_dm_crtc_init(dm, &mode_info->planes[i]->base, i)) { | 1359 | if (amdgpu_dm_crtc_init(dm, &mode_info->planes[i]->base, i)) { |
| 1360 | DRM_ERROR("KMS: Failed to initialize crtc\n"); | 1360 | DRM_ERROR("KMS: Failed to initialize crtc\n"); |
| 1361 | goto fail_free_planes; | 1361 | goto fail; |
| 1362 | } | 1362 | } |
| 1363 | 1363 | ||
| 1364 | dm->display_indexes_num = dm->dc->caps.max_streams; | 1364 | dm->display_indexes_num = dm->dc->caps.max_streams; |
| @@ -1375,20 +1375,20 @@ static int amdgpu_dm_initialize_drm_device(struct amdgpu_device *adev) | |||
| 1375 | 1375 | ||
| 1376 | aconnector = kzalloc(sizeof(*aconnector), GFP_KERNEL); | 1376 | aconnector = kzalloc(sizeof(*aconnector), GFP_KERNEL); |
| 1377 | if (!aconnector) | 1377 | if (!aconnector) |
| 1378 | goto fail_free_planes; | 1378 | goto fail; |
| 1379 | 1379 | ||
| 1380 | aencoder = kzalloc(sizeof(*aencoder), GFP_KERNEL); | 1380 | aencoder = kzalloc(sizeof(*aencoder), GFP_KERNEL); |
| 1381 | if (!aencoder) | 1381 | if (!aencoder) |
| 1382 | goto fail_free_connector; | 1382 | goto fail; |
| 1383 | 1383 | ||
| 1384 | if (amdgpu_dm_encoder_init(dm->ddev, aencoder, i)) { | 1384 | if (amdgpu_dm_encoder_init(dm->ddev, aencoder, i)) { |
| 1385 | DRM_ERROR("KMS: Failed to initialize encoder\n"); | 1385 | DRM_ERROR("KMS: Failed to initialize encoder\n"); |
| 1386 | goto fail_free_encoder; | 1386 | goto fail; |
| 1387 | } | 1387 | } |
| 1388 | 1388 | ||
| 1389 | if (amdgpu_dm_connector_init(dm, aconnector, i, aencoder)) { | 1389 | if (amdgpu_dm_connector_init(dm, aconnector, i, aencoder)) { |
| 1390 | DRM_ERROR("KMS: Failed to initialize connector\n"); | 1390 | DRM_ERROR("KMS: Failed to initialize connector\n"); |
| 1391 | goto fail_free_encoder; | 1391 | goto fail; |
| 1392 | } | 1392 | } |
| 1393 | 1393 | ||
| 1394 | if (dc_link_detect(dc_get_link_at_index(dm->dc, i), | 1394 | if (dc_link_detect(dc_get_link_at_index(dm->dc, i), |
| @@ -1413,14 +1413,14 @@ static int amdgpu_dm_initialize_drm_device(struct amdgpu_device *adev) | |||
| 1413 | case CHIP_VEGA10: | 1413 | case CHIP_VEGA10: |
| 1414 | if (dce110_register_irq_handlers(dm->adev)) { | 1414 | if (dce110_register_irq_handlers(dm->adev)) { |
| 1415 | DRM_ERROR("DM: Failed to initialize IRQ\n"); | 1415 | DRM_ERROR("DM: Failed to initialize IRQ\n"); |
| 1416 | goto fail_free_encoder; | 1416 | goto fail; |
| 1417 | } | 1417 | } |
| 1418 | break; | 1418 | break; |
| 1419 | #if defined(CONFIG_DRM_AMD_DC_DCN1_0) | 1419 | #if defined(CONFIG_DRM_AMD_DC_DCN1_0) |
| 1420 | case CHIP_RAVEN: | 1420 | case CHIP_RAVEN: |
| 1421 | if (dcn10_register_irq_handlers(dm->adev)) { | 1421 | if (dcn10_register_irq_handlers(dm->adev)) { |
| 1422 | DRM_ERROR("DM: Failed to initialize IRQ\n"); | 1422 | DRM_ERROR("DM: Failed to initialize IRQ\n"); |
| 1423 | goto fail_free_encoder; | 1423 | goto fail; |
| 1424 | } | 1424 | } |
| 1425 | /* | 1425 | /* |
| 1426 | * Temporary disable until pplib/smu interaction is implemented | 1426 | * Temporary disable until pplib/smu interaction is implemented |
| @@ -1430,17 +1430,15 @@ static int amdgpu_dm_initialize_drm_device(struct amdgpu_device *adev) | |||
| 1430 | #endif | 1430 | #endif |
| 1431 | default: | 1431 | default: |
| 1432 | DRM_ERROR("Usupported ASIC type: 0x%X\n", adev->asic_type); | 1432 | DRM_ERROR("Usupported ASIC type: 0x%X\n", adev->asic_type); |
| 1433 | goto fail_free_encoder; | 1433 | goto fail; |
| 1434 | } | 1434 | } |
| 1435 | 1435 | ||
| 1436 | drm_mode_config_reset(dm->ddev); | 1436 | drm_mode_config_reset(dm->ddev); |
| 1437 | 1437 | ||
| 1438 | return 0; | 1438 | return 0; |
| 1439 | fail_free_encoder: | 1439 | fail: |
| 1440 | kfree(aencoder); | 1440 | kfree(aencoder); |
| 1441 | fail_free_connector: | ||
| 1442 | kfree(aconnector); | 1441 | kfree(aconnector); |
| 1443 | fail_free_planes: | ||
| 1444 | for (i = 0; i < dm->dc->caps.max_planes; i++) | 1442 | for (i = 0; i < dm->dc->caps.max_planes; i++) |
| 1445 | kfree(mode_info->planes[i]); | 1443 | kfree(mode_info->planes[i]); |
| 1446 | return -1; | 1444 | return -1; |
