drm/amd/pm: Prevent divide by zero
authorjsg <jsg@openbsd.org>
Fri, 22 Jul 2022 06:19:59 +0000 (06:19 +0000)
committerjsg <jsg@openbsd.org>
Fri, 22 Jul 2022 06:19:59 +0000 (06:19 +0000)
From Yefim Barashkin
8c37e7a2000d795aaad7256950f43c25f2aac67f in linux 5.15.y/5.15.56
0638c98c17aa12fe914459c82cd178247e21fb2b in mainline linux

sys/dev/pci/drm/amd/pm/swsmu/smu11/smu_v11_0.c

index 2aef862..244b413 100644 (file)
@@ -1235,6 +1235,8 @@ int smu_v11_0_set_fan_speed_rpm(struct smu_context *smu,
        uint32_t crystal_clock_freq = 2500;
        uint32_t tach_period;
 
+       if (speed == 0)
+               return -EINVAL;
        /*
         * To prevent from possible overheat, some ASICs may have requirement
         * for minimum fan speed: