aboutsummaryrefslogtreecommitdiffstats
path: root/common/recipes-kernel/linux/linux-yocto-4.14.71/5480-drm-amd-pp-Avoid-divide-by-zero-in-fan_ctrl_set_fan_.patch
diff options
context:
space:
mode:
Diffstat (limited to 'common/recipes-kernel/linux/linux-yocto-4.14.71/5480-drm-amd-pp-Avoid-divide-by-zero-in-fan_ctrl_set_fan_.patch')
-rw-r--r--common/recipes-kernel/linux/linux-yocto-4.14.71/5480-drm-amd-pp-Avoid-divide-by-zero-in-fan_ctrl_set_fan_.patch43
1 files changed, 43 insertions, 0 deletions
diff --git a/common/recipes-kernel/linux/linux-yocto-4.14.71/5480-drm-amd-pp-Avoid-divide-by-zero-in-fan_ctrl_set_fan_.patch b/common/recipes-kernel/linux/linux-yocto-4.14.71/5480-drm-amd-pp-Avoid-divide-by-zero-in-fan_ctrl_set_fan_.patch
new file mode 100644
index 00000000..21108c47
--- /dev/null
+++ b/common/recipes-kernel/linux/linux-yocto-4.14.71/5480-drm-amd-pp-Avoid-divide-by-zero-in-fan_ctrl_set_fan_.patch
@@ -0,0 +1,43 @@
+From f1d64f3280a69b994c6295c374d1ae22c2764c92 Mon Sep 17 00:00:00 2001
+From: Rex Zhu <Rex.Zhu@amd.com>
+Date: Thu, 20 Sep 2018 11:50:26 +0800
+Subject: [PATCH 5480/5725] drm/amd/pp: Avoid divide-by-zero in
+ fan_ctrl_set_fan_speed_rpm
+
+The minRPM speed maybe equal to zero. so need to check
+input RPM not equal to 0, otherwise cause divide-by-zero driver crash.
+
+Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
+Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
+---
+ drivers/gpu/drm/amd/powerplay/hwmgr/smu7_thermal.c | 1 +
+ drivers/gpu/drm/amd/powerplay/hwmgr/vega10_thermal.c | 1 +
+ 2 files changed, 2 insertions(+)
+
+diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_thermal.c b/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_thermal.c
+index eef086c..5bdc0df 100644
+--- a/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_thermal.c
++++ b/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_thermal.c
+@@ -260,6 +260,7 @@ int smu7_fan_ctrl_set_fan_speed_rpm(struct pp_hwmgr *hwmgr, uint32_t speed)
+ if (hwmgr->thermal_controller.fanInfo.bNoFan ||
+ (hwmgr->thermal_controller.fanInfo.
+ ucTachometerPulsesPerRevolution == 0) ||
++ speed == 0 ||
+ (speed < hwmgr->thermal_controller.fanInfo.ulMinRPM) ||
+ (speed > hwmgr->thermal_controller.fanInfo.ulMaxRPM))
+ return 0;
+diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_thermal.c b/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_thermal.c
+index 538de6c..3f807d6 100644
+--- a/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_thermal.c
++++ b/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_thermal.c
+@@ -312,6 +312,7 @@ int vega10_fan_ctrl_set_fan_speed_rpm(struct pp_hwmgr *hwmgr, uint32_t speed)
+ int result = 0;
+
+ if (hwmgr->thermal_controller.fanInfo.bNoFan ||
++ speed == 0 ||
+ (speed < hwmgr->thermal_controller.fanInfo.ulMinRPM) ||
+ (speed > hwmgr->thermal_controller.fanInfo.ulMaxRPM))
+ return -1;
+--
+2.7.4
+