[PATCH 2/3] drm/i915/hdcp: Add encoder check in hdcp2_get_capability

Bhadane, Dnyaneshwar dnyaneshwar.bhadane at intel.com
Wed Jul 24 18:07:57 UTC 2024



> -----Original Message-----
> From: Intel-gfx <intel-gfx-bounces at lists.freedesktop.org> On Behalf Of Suraj
> Kandpal
> Sent: Monday, July 22, 2024 12:15 PM
> To: intel-gfx at lists.freedesktop.org; intel-xe at lists.freedesktop.org
> Cc: Nautiyal, Ankit K <ankit.k.nautiyal at intel.com>; Kandpal, Suraj
> <suraj.kandpal at intel.com>
> Subject: [PATCH 2/3] drm/i915/hdcp: Add encoder check in
> hdcp2_get_capability
> 
> Add encoder check in intel_hdcp2_get_capability to avoid null pointer error.
> 
> Signed-off-by: Suraj Kandpal <suraj.kandpal at intel.com>

LGTM. Thanks.
Reviewed-by: Dnyaneshwar Bhadane <dnyaneshwar.bhadane at intel.com>

> ---
>  drivers/gpu/drm/i915/display/intel_dp_hdcp.c | 11 +++++++++--
>  1 file changed, 9 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_dp_hdcp.c
> b/drivers/gpu/drm/i915/display/intel_dp_hdcp.c
> index 2edffe62f360..47f51a5ab493 100644
> --- a/drivers/gpu/drm/i915/display/intel_dp_hdcp.c
> +++ b/drivers/gpu/drm/i915/display/intel_dp_hdcp.c
> @@ -675,8 +675,15 @@ static
>  int intel_dp_hdcp2_get_capability(struct intel_connector *connector,
>  				  bool *capable)
>  {
> -	struct intel_digital_port *dig_port =
> intel_attached_dig_port(connector);
> -	struct drm_dp_aux *aux = &dig_port->dp.aux;
> +	struct intel_digital_port *dig_port;
> +	struct drm_dp_aux *aux;
> +
> +	*capable = false;
> +	if (!intel_attached_encoder(connector))
> +		return -EINVAL;
> +
> +	dig_port = intel_attached_dig_port(connector);
> +	aux = &dig_port->dp.aux;
> 
>  	return _intel_dp_hdcp2_get_capability(aux, capable);  }
> --
> 2.43.2



More information about the Intel-gfx mailing list