[PATCH 12/12] drm/edid: reduce magic when updating the EDID block checksum

Ville Syrjälä ville.syrjala at linux.intel.com
Thu Mar 31 14:59:48 UTC 2022


On Tue, Mar 29, 2022 at 09:42:19PM +0300, Jani Nikula wrote:
> The code modifying the EDID block should not need to do tricks to fix
> the checksum. We have a function for computing the checksum, use it.
> 
> Cc: Ville Syrjälä <ville.syrjala at linux.intel.com>
> Signed-off-by: Jani Nikula <jani.nikula at intel.com>
> ---
>  drivers/gpu/drm/drm_edid.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
> index d0a76781ed19..d2dfab28b5b7 100644
> --- a/drivers/gpu/drm/drm_edid.c
> +++ b/drivers/gpu/drm/drm_edid.c
> @@ -1840,8 +1840,8 @@ static struct edid *edid_filter_invalid_blocks(const struct edid *edid,
>  			memcpy(base++, block, EDID_LENGTH);
>  	}
>  
> -	new->checksum += new->extensions - valid_extensions;
>  	new->extensions = valid_extensions;
> +	new->checksum = edid_block_compute_checksum(new);

Seems to happen after we've validated the base block so this won't
accidentally fix up an already bad checksum.

Reviewed-by: Ville Syrjälä <ville.syrjala at linux.intel.com>

>
>  out:
>  	kfree(edid);
> -- 
> 2.30.2

-- 
Ville Syrjälä
Intel


More information about the dri-devel mailing list