drm/xe: Check pat.ops before dumping PAT settings
authorMichal Wajdeczko <michal.wajdeczko@intel.com>
Tue, 9 Apr 2024 10:51:06 +0000 (12:51 +0200)
committerMichal Wajdeczko <michal.wajdeczko@intel.com>
Wed, 10 Apr 2024 09:21:48 +0000 (11:21 +0200)
We may leave pat.ops unset when running on brand new platform or
when running as a VF.  While the former is unlikely, the latter
is valid (future) use case and will cause NPD when someone will
try to dump PAT settings by debugfs.

It's better to check pointer to pat.ops instead of specific .dump
hook, as we have this hook always defined for every .ops variant.

Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com>
Reviewed-by: Piotr Piórkowski <piotr.piorkowski@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20240409105106.1067-2-michal.wajdeczko@intel.com
drivers/gpu/drm/xe/xe_pat.c

index d76831a4e5d1d1b377c9a60ba283d9860655257d..d5b516f115ade9d8db189456e06efdd373146e43 100644 (file)
@@ -458,7 +458,7 @@ void xe_pat_dump(struct xe_gt *gt, struct drm_printer *p)
 {
        struct xe_device *xe = gt_to_xe(gt);
 
-       if (!xe->pat.ops->dump)
+       if (!xe->pat.ops)
                return;
 
        xe->pat.ops->dump(gt, p);