]> git.baikalelectronics.ru Git - kernel.git/commitdiff
drm/i915/guc: Assert guc->stage_desc_pool is allocated
authorChris Wilson <chris@chris-wilson.co.uk>
Mon, 6 Nov 2017 11:48:33 +0000 (11:48 +0000)
committerChris Wilson <chris@chris-wilson.co.uk>
Mon, 6 Nov 2017 13:57:21 +0000 (13:57 +0000)
Silence smatch by demonstrating that guc->stage_desc_pool is allocated
following a successful guc_stage_desc_pool_create(),

drivers/gpu/drm/i915/i915_guc_submission.c:1293 i915_guc_submission_init() error: we previously assumed 'guc->stage_desc_pool' could be null (see line 1261)

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Oscar Mateo <oscar.mateo@intel.com>
Cc: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20171106114833.31199-1-chris@chris-wilson.co.uk
Reviewed-by: Michal Wajdeczko <michal.wajdeczko@intel.com>
drivers/gpu/drm/i915/i915_guc_submission.c

index d14c1342f09dc043c9e60cd5e737c2ab0bd33a19..0ba2fc04fe9c141f7afac85b0000687183641aa1 100644 (file)
@@ -1264,10 +1264,16 @@ int i915_guc_submission_init(struct drm_i915_private *dev_priv)
        ret = guc_stage_desc_pool_create(guc);
        if (ret)
                return ret;
+       /*
+        * Keep static analysers happy, let them know that we allocated the
+        * vma after testing that it didn't exist earlier.
+        */
+       GEM_BUG_ON(!guc->stage_desc_pool);
 
        ret = guc_shared_data_create(guc);
        if (ret)
                goto err_stage_desc_pool;
+       GEM_BUG_ON(!guc->shared_data);
 
        ret = intel_guc_log_create(guc);
        if (ret < 0)
@@ -1276,10 +1282,12 @@ int i915_guc_submission_init(struct drm_i915_private *dev_priv)
        ret = guc_preempt_work_create(guc);
        if (ret)
                goto err_log;
+       GEM_BUG_ON(!guc->preempt_wq);
 
        ret = guc_ads_create(guc);
        if (ret < 0)
                goto err_wq;
+       GEM_BUG_ON(!guc->ads_vma);
 
        return 0;