[Intel-gfx] [PATCH 07/15] drm/i915/dsi: be defensive about out of bounds sequence id

Daniel Vetter daniel at ffwll.ch
Tue Jan 5 06:12:36 PST 2016


On Mon, Dec 21, 2015 at 03:10:58PM +0200, Jani Nikula wrote:
> Untie the VBT based generic panel driver from the VBT parsing, so that
> the two don't have to be updated in lockstep.
> 
> Signed-off-by: Jani Nikula <jani.nikula at intel.com>

Reviewed-by: Daniel Vetter <daniel.vetter at ffwll.ch>

> ---
>  drivers/gpu/drm/i915/intel_dsi_panel_vbt.c | 22 +++++++++++++++-------
>  1 file changed, 15 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_dsi_panel_vbt.c b/drivers/gpu/drm/i915/intel_dsi_panel_vbt.c
> index a5e99ac305da..45512e0df57a 100644
> --- a/drivers/gpu/drm/i915/intel_dsi_panel_vbt.c
> +++ b/drivers/gpu/drm/i915/intel_dsi_panel_vbt.c
> @@ -246,14 +246,21 @@ static const fn_mipi_elem_exec exec_elem[] = {
>   */
>  
>  static const char * const seq_name[] = {
> -	"UNDEFINED",
> -	"MIPI_SEQ_ASSERT_RESET",
> -	"MIPI_SEQ_INIT_OTP",
> -	"MIPI_SEQ_DISPLAY_ON",
> -	"MIPI_SEQ_DISPLAY_OFF",
> -	"MIPI_SEQ_DEASSERT_RESET"
> +	[MIPI_SEQ_ASSERT_RESET] = "MIPI_SEQ_ASSERT_RESET",
> +	[MIPI_SEQ_INIT_OTP] = "MIPI_SEQ_INIT_OTP",
> +	[MIPI_SEQ_DISPLAY_ON] = "MIPI_SEQ_DISPLAY_ON",
> +	[MIPI_SEQ_DISPLAY_OFF]  = "MIPI_SEQ_DISPLAY_OFF",
> +	[MIPI_SEQ_DEASSERT_RESET] = "MIPI_SEQ_DEASSERT_RESET",
>  };
>  
> +static const char *sequence_name(enum mipi_seq seq_id)
> +{
> +	if (seq_id < ARRAY_SIZE(seq_name) && seq_name[seq_id])
> +		return seq_name[seq_id];
> +	else
> +		return "(unknown)";
> +}
> +
>  static void generic_exec_sequence(struct intel_dsi *intel_dsi, const u8 *data)
>  {
>  	fn_mipi_elem_exec mipi_elem_exec;
> @@ -262,7 +269,8 @@ static void generic_exec_sequence(struct intel_dsi *intel_dsi, const u8 *data)
>  	if (!data)
>  		return;
>  
> -	DRM_DEBUG_DRIVER("Starting MIPI sequence - %s\n", seq_name[*data]);
> +	DRM_DEBUG_DRIVER("Starting MIPI sequence %u - %s\n",
> +			 *data, sequence_name(*data));
>  
>  	/* go to the first element of the sequence */
>  	data++;
> -- 
> 2.1.4
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch


More information about the Intel-gfx mailing list