]> git.baikalelectronics.ru Git - kernel.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)
commitd8c40843d10603afee9bd7113dbf9db9ed53706a
treec2adf0174613051b37795eda564ef537dada9727
parent099c9827e83f1001594f400a5bc8c4407585e578
powercap/intel_rapl: fix and tidy up error handling

Commit 4f025895e24f ("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: 4f025895e24f ("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