Return errors when set clock range

Instead of using assert to abort the application, the fix will
return the error code if the input parameters is incorrect.

Change-Id: I00861ddf1198386fb322ea06232a7178fb5ef4bd
Este commit está contenido en:
Bill(Shuzhou) Liu
2022-12-06 12:39:43 -06:00
padre fae4e1fc37
commit 8d347bb6c4
+9 -2
Ver fichero
@@ -1166,14 +1166,21 @@ rsmi_status_t rsmi_dev_clk_range_set(uint32_t dv_ind, uint64_t minclkvalue,
TRY
rsmi_status_t ret;
assert(minclkvalue < maxclkvalue);
if (minclkvalue >= maxclkvalue) {
return RSMI_STATUS_INVALID_ARGS;
}
// Can only set the clock type for sys and mem type
if (clkType != RSMI_CLK_TYPE_SYS && clkType != RSMI_CLK_TYPE_MEM) {
return RSMI_STATUS_NOT_SUPPORTED;
}
std::string min_sysvalue, max_sysvalue;
std::map<rsmi_clk_type_t, std::string> ClkStateMap = {
{RSMI_CLK_TYPE_SYS, "s"},
{RSMI_CLK_TYPE_MEM, "m"},
};
DEVICE_MUTEX
assert(clkType == RSMI_CLK_TYPE_SYS || clkType == RSMI_CLK_TYPE_MEM);
// Set perf. level to manual so that we can then set the power profile
ret = rsmi_dev_perf_level_set_v1(dv_ind, RSMI_DEV_PERF_LEVEL_MANUAL);