All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] amdgpu/dc: fix a bunch of misc whitespace.
@ 2017-10-03  4:27 Dave Airlie
       [not found] ` <20171003042715.9305-1-airlied-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Dave Airlie @ 2017-10-03  4:27 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

From: Dave Airlie <airlied@redhat.com>

This just aligns a few things with kernel style.

Signed-off-by: Dave Airlie <airlied@redhat.com>
---
 drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c   |  8 ++--
 drivers/gpu/drm/amd/display/dc/dc_types.h          | 16 ++++----
 .../display/dc/dce110/dce110_timing_generator.c    |  4 +-
 .../drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c  | 16 ++++----
 .../gpu/drm/amd/display/dc/dcn10/dcn10_mem_input.c | 46 +++++++++++-----------
 .../amd/display/include/grph_object_ctrl_defs.h    | 20 +++++-----
 6 files changed, 55 insertions(+), 55 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c b/drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c
index 888d268..3c323c1 100644
--- a/drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c
+++ b/drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c
@@ -1473,10 +1473,10 @@ void decide_link_settings(struct dc_stream_state *stream,
 		return;
 	}
 
-    /* search for the minimum link setting that:
-     * 1. is supported according to the link training result
-     * 2. could support the b/w requested by the timing
-     */
+	/* search for the minimum link setting that:
+	 * 1. is supported according to the link training result
+	 * 2. could support the b/w requested by the timing
+	 */
 	while (current_link_setting.link_rate <=
 			link->verified_link_cap.link_rate) {
 		link_bw = bandwidth_in_kbps_from_link_settings(
diff --git a/drivers/gpu/drm/amd/display/dc/dc_types.h b/drivers/gpu/drm/amd/display/dc/dc_types.h
index a47f7472..6b891fd 100644
--- a/drivers/gpu/drm/amd/display/dc/dc_types.h
+++ b/drivers/gpu/drm/amd/display/dc/dc_types.h
@@ -429,14 +429,14 @@ union audio_sample_rates {
 };
 
 struct audio_speaker_flags {
-    uint32_t FL_FR:1;
-    uint32_t LFE:1;
-    uint32_t FC:1;
-    uint32_t RL_RR:1;
-    uint32_t RC:1;
-    uint32_t FLC_FRC:1;
-    uint32_t RLC_RRC:1;
-    uint32_t SUPPORT_AI:1;
+	uint32_t FL_FR:1;
+	uint32_t LFE:1;
+	uint32_t FC:1;
+	uint32_t RL_RR:1;
+	uint32_t RC:1;
+	uint32_t FLC_FRC:1;
+	uint32_t RLC_RRC:1;
+	uint32_t SUPPORT_AI:1;
 };
 
 struct audio_speaker_info {
diff --git a/drivers/gpu/drm/amd/display/dc/dce110/dce110_timing_generator.c b/drivers/gpu/drm/amd/display/dc/dce110/dce110_timing_generator.c
index bcd544d..67ac737 100644
--- a/drivers/gpu/drm/amd/display/dc/dce110/dce110_timing_generator.c
+++ b/drivers/gpu/drm/amd/display/dc/dce110/dce110_timing_generator.c
@@ -1238,8 +1238,8 @@ void dce110_timing_generator_setup_global_swap_lock(
 			DCP_GSL_CONTROL,
 			DCP_GSL_HSYNC_FLIP_FORCE_DELAY);
 
-        /* Keep signal low (pending high) during 6 lines.
-         * Also defines minimum interval before re-checking signal. */
+	/* Keep signal low (pending high) during 6 lines.
+	 * Also defines minimum interval before re-checking signal. */
 	set_reg_field_value(value,
 			HFLIP_CHECK_DELAY,
 			DCP_GSL_CONTROL,
diff --git a/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c b/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c
index c4875c3..d3fee15 100644
--- a/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c
+++ b/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c
@@ -2396,14 +2396,14 @@ static void program_all_pipe_in_tree(
 		dcn10_power_on_fe(dc, pipe_ctx, context);
 
 		/* temporary dcn1 wa:
-                 *   watermark update requires toggle after a/b/c/d sets are programmed
-                 *   if hubp is pg then wm value doesn't get properaged to hubp
-                 *   need to toggle after ungate to ensure wm gets to hubp.
-                 *
-                 * final solution:  we need to get SMU to do the toggle as
-                 * DCHUBBUB_ARB_WATERMARK_CHANGE_REQUEST is owned by SMU we should have 
-                 * both driver and fw accessing same register
-                 */
+		 *   watermark update requires toggle after a/b/c/d sets are programmed
+		 *   if hubp is pg then wm value doesn't get properaged to hubp
+		 *   need to toggle after ungate to ensure wm gets to hubp.
+		 *
+		 * final solution:  we need to get SMU to do the toggle as
+		 * DCHUBBUB_ARB_WATERMARK_CHANGE_REQUEST is owned by SMU we should have
+		 * both driver and fw accessing same register
+		 */
 		toggle_watermark_change_req(dc->hwseq);
 
 		update_dchubp_dpp(dc, pipe_ctx, context);
diff --git a/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_mem_input.c b/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_mem_input.c
index c808848..a28495d 100644
--- a/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_mem_input.c
+++ b/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_mem_input.c
@@ -697,37 +697,37 @@ static void min10_set_vm_context0_settings(struct mem_input *mem_input,
 }
 
 static void min_set_viewport(
-               struct mem_input *mem_input,
-               const struct rect *viewport,
-               const struct rect *viewport_c)
+	struct mem_input *mem_input,
+	const struct rect *viewport,
+	const struct rect *viewport_c)
 {
 	struct dcn10_mem_input *mi = TO_DCN10_MEM_INPUT(mem_input);
 
-       REG_SET_2(DCSURF_PRI_VIEWPORT_DIMENSION, 0,
-                       PRI_VIEWPORT_WIDTH, viewport->width,
-                       PRI_VIEWPORT_HEIGHT, viewport->height);
+	REG_SET_2(DCSURF_PRI_VIEWPORT_DIMENSION, 0,
+		  PRI_VIEWPORT_WIDTH, viewport->width,
+		  PRI_VIEWPORT_HEIGHT, viewport->height);
 
-       REG_SET_2(DCSURF_PRI_VIEWPORT_START, 0,
-                       PRI_VIEWPORT_X_START, viewport->x,
-                       PRI_VIEWPORT_Y_START, viewport->y);
+	REG_SET_2(DCSURF_PRI_VIEWPORT_START, 0,
+		  PRI_VIEWPORT_X_START, viewport->x,
+		  PRI_VIEWPORT_Y_START, viewport->y);
 
-       /*for stereo*/
-       REG_SET_2(DCSURF_SEC_VIEWPORT_DIMENSION, 0,
-                               SEC_VIEWPORT_WIDTH, viewport->width,
-                               SEC_VIEWPORT_HEIGHT, viewport->height);
+	/*for stereo*/
+	REG_SET_2(DCSURF_SEC_VIEWPORT_DIMENSION, 0,
+		  SEC_VIEWPORT_WIDTH, viewport->width,
+		  SEC_VIEWPORT_HEIGHT, viewport->height);
 
-       REG_SET_2(DCSURF_SEC_VIEWPORT_START, 0,
-                               SEC_VIEWPORT_X_START, viewport->x,
-                               SEC_VIEWPORT_Y_START, viewport->y);
+	REG_SET_2(DCSURF_SEC_VIEWPORT_START, 0,
+		  SEC_VIEWPORT_X_START, viewport->x,
+		  SEC_VIEWPORT_Y_START, viewport->y);
 
-       /* DC supports NV12 only at the moment */
-       REG_SET_2(DCSURF_PRI_VIEWPORT_DIMENSION_C, 0,
-                       PRI_VIEWPORT_WIDTH_C, viewport_c->width,
-                       PRI_VIEWPORT_HEIGHT_C, viewport_c->height);
+	/* DC supports NV12 only at the moment */
+	REG_SET_2(DCSURF_PRI_VIEWPORT_DIMENSION_C, 0,
+		  PRI_VIEWPORT_WIDTH_C, viewport_c->width,
+		  PRI_VIEWPORT_HEIGHT_C, viewport_c->height);
 
-       REG_SET_2(DCSURF_PRI_VIEWPORT_START_C, 0,
-                       PRI_VIEWPORT_X_START_C, viewport_c->x,
-                       PRI_VIEWPORT_Y_START_C, viewport_c->y);
+	REG_SET_2(DCSURF_PRI_VIEWPORT_START_C, 0,
+		  PRI_VIEWPORT_X_START_C, viewport_c->x,
+		  PRI_VIEWPORT_Y_START_C, viewport_c->y);
 }
 
 void dcn10_mem_input_read_state(struct dcn10_mem_input *mi,
diff --git a/drivers/gpu/drm/amd/display/include/grph_object_ctrl_defs.h b/drivers/gpu/drm/amd/display/include/grph_object_ctrl_defs.h
index 92fe00f..7a9b43f 100644
--- a/drivers/gpu/drm/amd/display/include/grph_object_ctrl_defs.h
+++ b/drivers/gpu/drm/amd/display/include/grph_object_ctrl_defs.h
@@ -183,9 +183,9 @@ struct dc_firmware_info {
 };
 
 struct step_and_delay_info {
-    uint32_t step;
-    uint32_t delay;
-    uint32_t recommended_ref_div;
+	uint32_t step;
+	uint32_t delay;
+	uint32_t recommended_ref_div;
 };
 
 struct spread_spectrum_info {
@@ -266,16 +266,16 @@ struct transmitter_configuration {
 #define NUMBER_OF_AVAILABLE_SCLK 5
 
 struct i2c_reg_info {
-    unsigned char       i2c_reg_index;
-    unsigned char       i2c_reg_val;
+	unsigned char       i2c_reg_index;
+	unsigned char       i2c_reg_val;
 };
 
 struct ext_hdmi_settings {
-    unsigned char   slv_addr;
-    unsigned char   reg_num;
-    struct i2c_reg_info      reg_settings[9];
-    unsigned char   reg_num_6g;
-    struct i2c_reg_info      reg_settings_6g[3];
+	unsigned char   slv_addr;
+	unsigned char   reg_num;
+	struct i2c_reg_info      reg_settings[9];
+	unsigned char   reg_num_6g;
+	struct i2c_reg_info      reg_settings_6g[3];
 };
 
 
-- 
2.9.5

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/3] amdgpu/dc: kfree already checks for NULL.
       [not found] ` <20171003042715.9305-1-airlied-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2017-10-03  4:27   ` Dave Airlie
  2017-10-03  4:27   ` [PATCH 3/3] amdgpu/dm: don't use after free Dave Airlie
  1 sibling, 0 replies; 4+ messages in thread
From: Dave Airlie @ 2017-10-03  4:27 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

From: Dave Airlie <airlied@redhat.com>

Don't bother checking for it.

Found with the cocci ifnullfree.cocci script.

Signed-off-by: Dave Airlie <airlied@redhat.com>
---
 drivers/gpu/drm/amd/display/dc/basics/vector.c          |  3 +--
 drivers/gpu/drm/amd/display/dc/bios/bios_parser.c       |  7 ++-----
 drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c      |  7 ++-----
 drivers/gpu/drm/amd/display/dc/core/dc_resource.c       |  3 +--
 drivers/gpu/drm/amd/display/dc/dce110/dce110_resource.c | 11 +++--------
 5 files changed, 9 insertions(+), 22 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/dc/basics/vector.c b/drivers/gpu/drm/amd/display/dc/basics/vector.c
index e00fc4db..217b8f1 100644
--- a/drivers/gpu/drm/amd/display/dc/basics/vector.c
+++ b/drivers/gpu/drm/amd/display/dc/basics/vector.c
@@ -130,8 +130,7 @@ struct vector *dal_vector_create(
 void dal_vector_destruct(
 	struct vector *vector)
 {
-	if (vector->container != NULL)
-		kfree(vector->container);
+	kfree(vector->container);
 	vector->count = 0;
 	vector->capacity = 0;
 }
diff --git a/drivers/gpu/drm/amd/display/dc/bios/bios_parser.c b/drivers/gpu/drm/amd/display/dc/bios/bios_parser.c
index 2e003b5..6d2f886 100644
--- a/drivers/gpu/drm/amd/display/dc/bios/bios_parser.c
+++ b/drivers/gpu/drm/amd/display/dc/bios/bios_parser.c
@@ -119,11 +119,8 @@ struct dc_bios *bios_parser_create(
 
 static void destruct(struct bios_parser *bp)
 {
-	if (bp->base.bios_local_image)
-		kfree(bp->base.bios_local_image);
-
-	if (bp->base.integrated_info)
-		kfree(bp->base.integrated_info);
+	kfree(bp->base.bios_local_image);
+	kfree(bp->base.integrated_info);
 }
 
 static void bios_parser_destroy(struct dc_bios **dcb)
diff --git a/drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c b/drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c
index 0c623b3..3d65e2a 100644
--- a/drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c
+++ b/drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c
@@ -85,11 +85,8 @@ static struct atom_encoder_caps_record *get_encoder_cap_record(
 
 static void destruct(struct bios_parser *bp)
 {
-	if (bp->base.bios_local_image)
-		kfree(bp->base.bios_local_image);
-
-	if (bp->base.integrated_info)
-		kfree(bp->base.integrated_info);
+	kfree(bp->base.bios_local_image);
+	kfree(bp->base.integrated_info);
 }
 
 static void firmware_parser_destroy(struct dc_bios **dcb)
diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_resource.c b/drivers/gpu/drm/amd/display/dc/core/dc_resource.c
index 057bfe6..77b3474 100644
--- a/drivers/gpu/drm/amd/display/dc/core/dc_resource.c
+++ b/drivers/gpu/drm/amd/display/dc/core/dc_resource.c
@@ -159,8 +159,7 @@ void dc_destroy_resource_pool(struct dc  *dc)
 		if (dc->res_pool)
 			dc->res_pool->funcs->destroy(&dc->res_pool);
 
-		if (dc->hwseq)
-			kfree(dc->hwseq);
+		kfree(dc->hwseq);
 	}
 }
 
diff --git a/drivers/gpu/drm/amd/display/dc/dce110/dce110_resource.c b/drivers/gpu/drm/amd/display/dc/dce110/dce110_resource.c
index 89036af..28e768d 100644
--- a/drivers/gpu/drm/amd/display/dc/dce110/dce110_resource.c
+++ b/drivers/gpu/drm/amd/display/dc/dce110/dce110_resource.c
@@ -619,14 +619,9 @@ void dce110_clock_source_destroy(struct clock_source **clk_src)
 
 	dce110_clk_src = TO_DCE110_CLK_SRC(*clk_src);
 
-	if (dce110_clk_src->dp_ss_params)
-		kfree(dce110_clk_src->dp_ss_params);
-
-	if (dce110_clk_src->hdmi_ss_params)
-		kfree(dce110_clk_src->hdmi_ss_params);
-
-	if (dce110_clk_src->dvi_ss_params)
-		kfree(dce110_clk_src->dvi_ss_params);
+	kfree(dce110_clk_src->dp_ss_params);
+	kfree(dce110_clk_src->hdmi_ss_params);
+	kfree(dce110_clk_src->dvi_ss_params);
 
 	kfree(dce110_clk_src);
 	*clk_src = NULL;
-- 
2.9.5

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 3/3] amdgpu/dm: don't use after free.
       [not found] ` <20171003042715.9305-1-airlied-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
  2017-10-03  4:27   ` [PATCH 2/3] amdgpu/dc: kfree already checks for NULL Dave Airlie
@ 2017-10-03  4:27   ` Dave Airlie
       [not found]     ` <20171003042715.9305-3-airlied-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
  1 sibling, 1 reply; 4+ messages in thread
From: Dave Airlie @ 2017-10-03  4:27 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

From: Dave Airlie <airlied@redhat.com>

This dereference acrtc after freeing it.

Found by the kfree cocci script.

Signed-off-by: Dave Airlie <airlied@redhat.com>
---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 1 -
 1 file changed, 1 deletion(-)

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 61ccddd..4f89731 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
@@ -3174,7 +3174,6 @@ int amdgpu_dm_crtc_init(struct amdgpu_display_manager *dm,
 fail:
 	kfree(acrtc);
 	kfree(cursor_plane);
-	acrtc->crtc_id = -1;
 	return res;
 }
 
-- 
2.9.5

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 3/3] amdgpu/dm: don't use after free.
       [not found]     ` <20171003042715.9305-3-airlied-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2017-10-03 15:17       ` Harry Wentland
  0 siblings, 0 replies; 4+ messages in thread
From: Harry Wentland @ 2017-10-03 15:17 UTC (permalink / raw)
  To: Dave Airlie, amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

On 2017-10-03 12:27 AM, Dave Airlie wrote:
> From: Dave Airlie <airlied@redhat.com>
> 
> This dereference acrtc after freeing it.
> 
> Found by the kfree cocci script.
> 
> Signed-off-by: Dave Airlie <airlied@redhat.com>

Series is
Reviewed-by: Harry Wentland <harry.wentland@amd.com>

Harry

> ---
>  drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 1 -
>  1 file changed, 1 deletion(-)
> 
> 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 61ccddd..4f89731 100644
> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> @@ -3174,7 +3174,6 @@ int amdgpu_dm_crtc_init(struct amdgpu_display_manager *dm,
>  fail:
>  	kfree(acrtc);
>  	kfree(cursor_plane);
> -	acrtc->crtc_id = -1;
>  	return res;
>  }
>  
> 
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-10-03 15:17 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-10-03  4:27 [PATCH 1/3] amdgpu/dc: fix a bunch of misc whitespace Dave Airlie
     [not found] ` <20171003042715.9305-1-airlied-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-10-03  4:27   ` [PATCH 2/3] amdgpu/dc: kfree already checks for NULL Dave Airlie
2017-10-03  4:27   ` [PATCH 3/3] amdgpu/dm: don't use after free Dave Airlie
     [not found]     ` <20171003042715.9305-3-airlied-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-10-03 15:17       ` Harry Wentland

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.