drm/framebuffer: break out of loop, if the requested element is found
Subsystems (2)
PATCH 1/1 drm/framebuffer: break out of loop, if the requested element is found
We can stop searching through the linked-list after we have found the element we are looking for. So, break out of list_for_each_entry() after we have found the element we are looking for in drm_mode_rmfb().
Signed-off-by Hamza Mahfooz <[email protected]>
--- drivers/gpu/drm/drm_framebuffer.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/gpu/drm/drm_framebuffer.c +4 -1
@@ -441,8 +441,11 @@ int drm_mode_rmfb(struct drm_device *dev, u32 fb_id,mutex_lock (&file_priv->fbs_lock);list_for_each_entry (fbl, &file_priv->fbs, filp_head) -if (fb == fbl) +if (fb == fbl) { found =1 ; +break ; + } +if (!found) {mutex_unlock (&file_priv->fbs_lock); goto fail_unref;
Signature · 1 line
2.37.3