diff mbox series

[3/3] drm/xe/hdcp: Check GSC structure validity

Message ID 20240722064451.3610512-4-suraj.kandpal@intel.com (mailing list archive)
State New, archived
Headers show
Series Fix null pointer error in HDCP capability check | expand

Commit Message

Kandpal, Suraj July 22, 2024, 6:44 a.m. UTC
Sometimes xe_gsc is not initialized when checked at HDCP capability
check. Add gsc structure check to avoid null pointer error.

Signed-off-by: Suraj Kandpal <suraj.kandpal@intel.com>
---
 drivers/gpu/drm/xe/display/xe_hdcp_gsc.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

Comments

Bhadane, Dnyaneshwar July 24, 2024, 6:11 p.m. UTC | #1
> -----Original Message-----
> From: Intel-xe <intel-xe-bounces@lists.freedesktop.org> On Behalf Of Suraj
> Kandpal
> Sent: Monday, July 22, 2024 12:15 PM
> To: intel-gfx@lists.freedesktop.org; intel-xe@lists.freedesktop.org
> Cc: Nautiyal, Ankit K <ankit.k.nautiyal@intel.com>; Kandpal, Suraj
> <suraj.kandpal@intel.com>
> Subject: [PATCH 3/3] drm/xe/hdcp: Check GSC structure validity
> 
> Sometimes xe_gsc is not initialized when checked at HDCP capability check.
> Add gsc structure check to avoid null pointer error.
> 
> Signed-off-by: Suraj Kandpal <suraj.kandpal@intel.com>

LGTM. Thanks.
Reviewed-by: Dnyaneshwar Bhadane <dnyaneshwar.bhadane@intel.com>
> ---
>  drivers/gpu/drm/xe/display/xe_hdcp_gsc.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/xe/display/xe_hdcp_gsc.c
> b/drivers/gpu/drm/xe/display/xe_hdcp_gsc.c
> index 990285aa9b26..0af667ebebf9 100644
> --- a/drivers/gpu/drm/xe/display/xe_hdcp_gsc.c
> +++ b/drivers/gpu/drm/xe/display/xe_hdcp_gsc.c
> @@ -40,10 +40,14 @@ bool intel_hdcp_gsc_check_status(struct xe_device
> *xe)  {
>  	struct xe_tile *tile = xe_device_get_root_tile(xe);
>  	struct xe_gt *gt = tile->media_gt;
> +	struct xe_gsc *gsc = &gt->uc.gsc;
>  	bool ret = true;
> 
> -	if (!xe_uc_fw_is_enabled(&gt->uc.gsc.fw))
> +	if (!gsc && !xe_uc_fw_is_enabled(&gsc->fw)) {
> +		drm_dbg_kms(&xe->drm,
> +			    "GSC Components not ready for HDCP2.x\n");
>  		return false;
> +	}
> 
>  	xe_pm_runtime_get(xe);
>  	if (xe_force_wake_get(gt_to_fw(gt), XE_FW_GSC)) { @@ -53,7 +57,7
> @@ bool intel_hdcp_gsc_check_status(struct xe_device *xe)
>  		goto out;
>  	}
> 
> -	if (!xe_gsc_proxy_init_done(&gt->uc.gsc))
> +	if (!xe_gsc_proxy_init_done(gsc))
>  		ret = false;
> 
>  	xe_force_wake_put(gt_to_fw(gt), XE_FW_GSC);
> --
> 2.43.2
diff mbox series

Patch

diff --git a/drivers/gpu/drm/xe/display/xe_hdcp_gsc.c b/drivers/gpu/drm/xe/display/xe_hdcp_gsc.c
index 990285aa9b26..0af667ebebf9 100644
--- a/drivers/gpu/drm/xe/display/xe_hdcp_gsc.c
+++ b/drivers/gpu/drm/xe/display/xe_hdcp_gsc.c
@@ -40,10 +40,14 @@  bool intel_hdcp_gsc_check_status(struct xe_device *xe)
 {
 	struct xe_tile *tile = xe_device_get_root_tile(xe);
 	struct xe_gt *gt = tile->media_gt;
+	struct xe_gsc *gsc = &gt->uc.gsc;
 	bool ret = true;
 
-	if (!xe_uc_fw_is_enabled(&gt->uc.gsc.fw))
+	if (!gsc && !xe_uc_fw_is_enabled(&gsc->fw)) {
+		drm_dbg_kms(&xe->drm,
+			    "GSC Components not ready for HDCP2.x\n");
 		return false;
+	}
 
 	xe_pm_runtime_get(xe);
 	if (xe_force_wake_get(gt_to_fw(gt), XE_FW_GSC)) {
@@ -53,7 +57,7 @@  bool intel_hdcp_gsc_check_status(struct xe_device *xe)
 		goto out;
 	}
 
-	if (!xe_gsc_proxy_init_done(&gt->uc.gsc))
+	if (!xe_gsc_proxy_init_done(gsc))
 		ret = false;
 
 	xe_force_wake_put(gt_to_fw(gt), XE_FW_GSC);