]> git.baikalelectronics.ru Git - kernel.git/commit
drm/amdgpu: Fix error handling in amdgpu_flip_work_func.
authorMario Kleiner <mario.kleiner.de@gmail.com>
Tue, 1 Mar 2016 20:31:16 +0000 (21:31 +0100)
committerAlex Deucher <alexander.deucher@amd.com>
Sat, 5 Mar 2016 17:31:45 +0000 (12:31 -0500)
commitead3fbe7195a51d4c3aa331479ec12b5153405b7
tree36a50d847b90bf8108d2f00584a8abd154ce5780
parentded444024b753e9acef2d09484e216ef8da1c5ad
drm/amdgpu: Fix error handling in amdgpu_flip_work_func.

The patch b5def53dd276: "drm/amdgpu: Don't hang in
amdgpu_flip_work_func on disabled crtc." from Feb 19, 2016, leads to
the following static checker warning, as reported by Dan Carpenter in
https://lists.freedesktop.org/archives/dri-devel/2016-February/101987.html

drivers/gpu/drm/amd/amdgpu/amdgpu_display.c:127 amdgpu_flip_work_func() warn: should this be 'repcnt == -1'
drivers/gpu/drm/amd/amdgpu/amdgpu_display.c:136 amdgpu_flip_work_func() error: double unlock 'spin_lock:&crtc->dev->event_lock'
drivers/gpu/drm/amd/amdgpu/amdgpu_display.c:136 amdgpu_flip_work_func() error: double unlock 'irqsave:flags'

This patch fixes both reported problems:

Change post-decrement of repcnt to pre-decrement, so
it can't underflow anymore, but still performs up to
three repetitions - three is the maximum one could
expect in practice.

Move the spin_unlock_irqrestore to where it actually
belongs.

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com>
Cc: <stable@vger.kernel.org> # 4.4+
Cc: Michel Dänzer <michel.daenzer@amd.com>
Cc: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_display.c