Re: [PATCH] gma500: fix an incorrect NULL check on list iterator

2022-03-29 Thread Patrik Jakobsson
On Sun, Mar 27, 2022 at 7:20 AM Xiaomeng Tong wrote: > > 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 i

[PATCH] gma500: fix an incorrect NULL check on list iterator

2022-03-26 Thread Xiaomeng Tong
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 retur