OSDN Git Service

drm/msm/dpu: simplify dpu_encoder_phys_wb_init()
authorDmitry Baryshkov <dmitry.baryshkov@linaro.org>
Thu, 1 Jun 2023 17:22:36 +0000 (20:22 +0300)
committerDmitry Baryshkov <dmitry.baryshkov@linaro.org>
Sun, 4 Jun 2023 02:41:47 +0000 (05:41 +0300)
There is no need to assign a result to temp varable just to return it
after a goto. Drop the temporary variable and goto and return the result
directly.

Reviewed-by: Abhinav Kumar <quic_abhinavk@quicinc.com>
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Tested-by: Abhinav Kumar <quic_abhinavk@quicinc.com> # sc7280
Patchwork: https://patchwork.freedesktop.org/patch/540639/
Link: https://lore.kernel.org/r/20230601172236.564445-8-dmitry.baryshkov@linaro.org
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_wb.c

index 6608c00..e9325ca 100644 (file)
@@ -684,21 +684,18 @@ struct dpu_encoder_phys *dpu_encoder_phys_wb_init(
 {
        struct dpu_encoder_phys *phys_enc = NULL;
        struct dpu_encoder_phys_wb *wb_enc = NULL;
-       int ret = 0;
 
        DPU_DEBUG("\n");
 
        if (!p || !p->parent) {
                DPU_ERROR("invalid params\n");
-               ret = -EINVAL;
-               goto fail_alloc;
+               return ERR_PTR(-EINVAL);
        }
 
        wb_enc = kzalloc(sizeof(*wb_enc), GFP_KERNEL);
        if (!wb_enc) {
                DPU_ERROR("failed to allocate wb phys_enc enc\n");
-               ret = -ENOMEM;
-               goto fail_alloc;
+               return ERR_PTR(-ENOMEM);
        }
 
        phys_enc = &wb_enc->base;
@@ -715,7 +712,4 @@ struct dpu_encoder_phys *dpu_encoder_phys_wb_init(
        DPU_DEBUG("Created dpu_encoder_phys for wb %d\n", phys_enc->hw_wb->idx);
 
        return phys_enc;
-
-fail_alloc:
-       return ERR_PTR(ret);
 }