]> git.baikalelectronics.ru Git - kernel.git/commit
gma500: fix an incorrect NULL check on list iterator
authorXiaomeng Tong <xiam0nd.tong@gmail.com>
Sun, 27 Mar 2022 05:20:28 +0000 (13:20 +0800)
committerPatrik Jakobsson <patrik.r.jakobsson@gmail.com>
Tue, 29 Mar 2022 09:33:11 +0000 (11:33 +0200)
commitbcbadc2d4f8eb72f99626a5aa892d90323af3235
treeb52cd89e558188ac4235c5f29f81c337d28ff4dd
parenta6659eb169d47e7134bb8f2f5381b2648122142b
gma500: fix an incorrect NULL check on list iterator

The bug is here:
return crtc;

The list iterator value 'crtc' will *always* be set and non-NULL by
list_for_each_entry(), so it is incorrect to assume that the iterator
value will be NULL if the list is empty or no element is found.

To fix the bug, return 'crtc' when found, otherwise return NULL.

Cc: stable@vger.kernel.org
fixes: b363e346c8d95 ("gma500: Add Poulsbo support")
Signed-off-by: Xiaomeng Tong <xiam0nd.tong@gmail.com>
Signed-off-by: Patrik Jakobsson <patrik.r.jakobsson@gmail.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20220327052028.2013-1-xiam0nd.tong@gmail.com
drivers/gpu/drm/gma500/psb_intel_display.c