AMD-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
To: ray.huang-5C7GfCeVMHo@public.gmane.org
Cc: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
Subject: [bug report] drm/amd/powerplay: add control gfxoff enabling in late init
Date: Thu, 17 May 2018 17:13:44 +0300	[thread overview]
Message-ID: <20180517141344.GA21743@mwanda> (raw)

Hello Huang Rui,

The patch 9667849bbb8d: "drm/amd/powerplay: add control gfxoff
enabling in late init" from Mar 13, 2018, leads to the following
static checker warning:

	drivers/gpu/drm/amd/amdgpu/../powerplay/amd_powerplay.c:194 pp_late_init()
	error: we previously assumed 'hwmgr' could be null (see line 185)

drivers/gpu/drm/amd/amdgpu/../powerplay/amd_powerplay.c
   179  static int pp_late_init(void *handle)
   180  {
   181          struct amdgpu_device *adev = handle;
   182          struct pp_hwmgr *hwmgr = adev->powerplay.pp_handle;
   183          int ret;
   184  
   185          if (hwmgr && hwmgr->pm_en) {
                    ^^^^^
Check

   186                  mutex_lock(&hwmgr->smu_lock);
   187                  hwmgr_handle_task(hwmgr,
   188                                          AMD_PP_TASK_COMPLETE_INIT, NULL);
   189                  mutex_unlock(&hwmgr->smu_lock);
   190          }
   191          if (adev->pm.smu_prv_buffer_size != 0)
   192                  pp_reserve_vram_for_smu(adev);
   193  
   194          if (hwmgr->hwmgr_func->gfx_off_control &&
                    ^^^^^^^^^^^^^^^^^^
Patch adds unchecked dereference.

   195              (hwmgr->feature_mask & PP_GFXOFF_MASK)) {
   196                  ret = hwmgr->hwmgr_func->gfx_off_control(hwmgr, true);
   197                  if (ret)
   198                          pr_err("gfx off enabling failed!\n");
   199          }
   200  
   201          return 0;
   202  }

regards,
dan carpenter
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

                 reply	other threads:[~2018-05-17 14:13 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180517141344.GA21743@mwanda \
    --to=dan.carpenter-qhclzuegtsvqt0dzr+alfa@public.gmane.org \
    --cc=amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
    --cc=ray.huang-5C7GfCeVMHo@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox