]> git.baikalelectronics.ru Git - kernel.git/commit
drm/amd/display: Possible divide by zero in set_speed()
authorDan Carpenter <dan.carpenter@oracle.com>
Fri, 31 Jan 2020 04:57:39 +0000 (07:57 +0300)
committerAlex Deucher <alexander.deucher@amd.com>
Fri, 13 Mar 2020 15:52:35 +0000 (11:52 -0400)
commitb4f1331206223d6621a65ce9acd380e3f6da18e1
tree04b4d01fa15a3339bec2a81b4e41fcf5603dc02f
parente83ae9a68fd7f9b71ef597ab5f2861b07582f96c
drm/amd/display: Possible divide by zero in set_speed()

If "speed" is zero then we use it as a divisor to find "prescale".  It's
better to move the check for zero to the very start of the function.

Fixes: 60c9a36681c5 ("drm/amd/display: Refine i2c frequency calculating sequence")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/display/dc/dce/dce_i2c_hw.c