mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-06 19:08:57 +09:00
drm/rockchip: driver: fix sub_dev pointer error
the sub_dev will be update by list_for_each_entry() and return !NULL error pointer when no found subdev; Signed-off-by: Sandy Huang <hjc@rock-chips.com> Change-Id: I8d7db3b66c6c57b986a42cac9ed6eca53b72611e
This commit is contained in:
committed by
Huang Jiachai
parent
89d6a276b6
commit
8c8f462197
@@ -122,15 +122,18 @@ EXPORT_SYMBOL(rockchip_drm_unregister_sub_dev);
|
||||
struct rockchip_drm_sub_dev *rockchip_drm_get_sub_dev(struct device_node *node)
|
||||
{
|
||||
struct rockchip_drm_sub_dev *sub_dev = NULL;
|
||||
bool found = false;
|
||||
|
||||
mutex_lock(&rockchip_drm_sub_dev_lock);
|
||||
list_for_each_entry(sub_dev, &rockchip_drm_sub_dev_list, list) {
|
||||
if (sub_dev->of_node == node)
|
||||
if (sub_dev->of_node == node) {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
mutex_unlock(&rockchip_drm_sub_dev_lock);
|
||||
|
||||
return sub_dev;
|
||||
return found ? sub_dev : NULL;
|
||||
}
|
||||
EXPORT_SYMBOL(rockchip_drm_get_sub_dev);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user