From: jsg Date: Fri, 22 Jul 2022 06:19:59 +0000 (+0000) Subject: drm/amd/pm: Prevent divide by zero X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=077e4f43f90cbed669df6eb6763e15ce63a34070;p=openbsd drm/amd/pm: Prevent divide by zero From Yefim Barashkin 8c37e7a2000d795aaad7256950f43c25f2aac67f in linux 5.15.y/5.15.56 0638c98c17aa12fe914459c82cd178247e21fb2b in mainline linux --- diff --git a/sys/dev/pci/drm/amd/pm/swsmu/smu11/smu_v11_0.c b/sys/dev/pci/drm/amd/pm/swsmu/smu11/smu_v11_0.c index 2aef862325a..244b413447d 100644 --- a/sys/dev/pci/drm/amd/pm/swsmu/smu11/smu_v11_0.c +++ b/sys/dev/pci/drm/amd/pm/swsmu/smu11/smu_v11_0.c @@ -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: