All of lore.kernel.org
 help / color / mirror / Atom feed
* [bug report] amd\powerplay Implement get dal power level
@ 2018-04-04 14:28 Dan Carpenter
  0 siblings, 0 replies; only message in thread
From: Dan Carpenter @ 2018-04-04 14:28 UTC (permalink / raw)
  To: vitaly.prosyak-5C7GfCeVMHo; +Cc: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

[ 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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2018-04-04 14:28 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-04-04 14:28 [bug report] amd\powerplay Implement get dal power level Dan Carpenter

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.