]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commit
firmware: arm_scmi: fix divide by zero when sustained_perf_level is zero
authorSudeep Holla <sudeep.holla@arm.com>
Thu, 6 Sep 2018 15:10:39 +0000 (16:10 +0100)
committerOlof Johansson <olof@lixom.net>
Thu, 6 Sep 2018 16:59:40 +0000 (09:59 -0700)
commit96d529bac562574600eda85726fcfa3eef6dde8e
tree680a3d261814ef7157c0d3cf09bf851b05f40b25
parenta72b44a871c218e2a0580e68affa1d3528c0587a
firmware: arm_scmi: fix divide by zero when sustained_perf_level is zero

Firmware can provide zero as values for sustained performance level and
corresponding sustained frequency in kHz in order to hide the actual
frequencies and provide only abstract values. It may endup with divide
by zero scenario resulting in kernel panic.

Let's set the multiplication factor to one if either one or both of them
(sustained_perf_level and sustained_freq) are set to zero.

Fixes: a9e3fbfaa0ff ("firmware: arm_scmi: add initial support for performance protocol")
Reported-by: Ionela Voinescu <ionela.voinescu@arm.com>
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
Signed-off-by: Olof Johansson <olof@lixom.net>
drivers/firmware/arm_scmi/perf.c