AMD-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
To: vitaly.prosyak-5C7GfCeVMHo@public.gmane.org
Cc: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
Subject: [bug report] amd\powerplay Implement get dal power level
Date: Wed, 4 Apr 2018 17:28:09 +0300	[thread overview]
Message-ID: <20180404142809.GA14273@mwanda> (raw)

[ This is pretty old, but it showed up as a new warning because of the
  recent renames.  It's a private unpublished Smatch check.  -dan ]

Hello Vitaly Prosyak,

The patch c4dd206be156: "amd\powerplay Implement get dal power level"
from Nov 30, 2015, leads to the following static checker warning:

	drivers/gpu/drm/amd/amdgpu/../powerplay/hwmgr/smu8_hwmgr.c:1485 smu8_get_dal_power_level()
	warn: why is zero skipped 'i'

drivers/gpu/drm/amd/amdgpu/../powerplay/hwmgr/smu8_hwmgr.c
  1472  static int smu8_get_dal_power_level(struct pp_hwmgr *hwmgr,
  1473                  struct amd_pp_simple_clock_info *info)
  1474  {
  1475          uint32_t i;
                ^^^^^^^^^^
If you change anything you'll probably want to make this an int.

  1476          const struct phm_clock_voltage_dependency_table *table =
  1477                          hwmgr->dyn_state.vddc_dep_on_dal_pwrl;
  1478          const struct phm_clock_and_voltage_limits *limits =
  1479                          &hwmgr->dyn_state.max_clock_voltage_on_ac;
  1480  
  1481          info->engine_max_clock = limits->sclk;
  1482          info->memory_max_clock = limits->mclk;
  1483  
  1484          for (i = table->count - 1; i > 0; i--) {
  1485                  if (limits->vddc >= table->entries[i].v) {
  1486                          info->level = table->entries[i].clk;
                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
I sort of do think we should be using table->entries[0] here?

  1487                          return 0;
  1488                  }
  1489          }
  1490          return -EINVAL;
  1491  }

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

                 reply	other threads:[~2018-04-04 14:28 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=20180404142809.GA14273@mwanda \
    --to=dan.carpenter-qhclzuegtsvqt0dzr+alfa@public.gmane.org \
    --cc=amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
    --cc=vitaly.prosyak-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