Skip to content
Commit cb43f81b authored by Jacob Pan's avatar Jacob Pan Committed by Rafael J. Wysocki
Browse files

powercap/intel_rapl: fix and tidy up error handling



Commit e1399ba2 ("powercap / RAPL: handle missing MSRs") added
contraint_to_pl() function to return index into an array. But it
can potentially return -EINVAL if powercap layer sends an out of
range constraint ID. This patch adds sanity check.

Unnecessary RAPL domain pointer check is removed since it must be
initialized before calling rapl_unit_xlate().

Fixes: e1399ba2 ("powercap / RAPL: handle missing MSRs")
Reported-by: default avatarOdzioba, Lukasz <lukasz.odzioba@intel.com>
Reported-by: default avatarKoss, Marcin <marcin.koss@intel.com>
Signed-off-by: default avatarJacob Pan <jacob.jun.pan@linux.intel.com>
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
parent b4005e92
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment