]> git.karo-electronics.de Git - linux-beck.git/commit
powercap/intel_rapl: fix and tidy up error handling
authorJacob Pan <jacob.jun.pan@linux.intel.com>
Mon, 28 Nov 2016 21:53:11 +0000 (13:53 -0800)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Mon, 28 Nov 2016 23:02:29 +0000 (00:02 +0100)
commitcb43f81b8489dcb87555e16c17453f0a9fa690f2
treec2adf0174613051b37795eda564ef537dada9727
parentb4005e9278a4e62819fb16ba4bc3430ca650d0ab
powercap/intel_rapl: fix and tidy up error handling

Commit e1399ba20eee ("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: e1399ba20eee ("powercap / RAPL: handle missing MSRs")
Reported-by: Odzioba, Lukasz <lukasz.odzioba@intel.com>
Reported-by: Koss, Marcin <marcin.koss@intel.com>
Signed-off-by: Jacob Pan <jacob.jun.pan@linux.intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/powercap/intel_rapl.c