OSDN Git Service

drm/amd/display: Return directly after a failed kzalloc() in dc_create()
authorMarkus Elfring <elfring@users.sourceforge.net>
Sat, 19 Dec 2020 17:04:33 +0000 (18:04 +0100)
committerAlex Deucher <alexander.deucher@amd.com>
Wed, 23 Dec 2020 20:07:44 +0000 (15:07 -0500)
* Return directly after a call of the function “kzalloc” failed
  at the beginning.

* Delete a label which became unnecessary with this refactoring.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/display/dc/core/dc.c

index 58eb0d6..1f0f2a4 100644 (file)
@@ -964,8 +964,8 @@ struct dc *dc_create(const struct dc_init_data *init_params)
        struct dc *dc = kzalloc(sizeof(*dc), GFP_KERNEL);
        unsigned int full_pipe_count;
 
-       if (NULL == dc)
-               goto alloc_fail;
+       if (!dc)
+               return NULL;
 
        if (init_params->dce_environment == DCE_ENV_VIRTUAL_HW) {
                if (false == dc_construct_ctx(dc, init_params)) {
@@ -1009,8 +1009,6 @@ struct dc *dc_create(const struct dc_init_data *init_params)
 
 construct_fail:
        kfree(dc);
-
-alloc_fail:
        return NULL;
 }