Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

drm/bridge: make of_drm_find_bridge() a wrapper of of_drm_find_and_get_bridge()

of_drm_find_bridge() is identical to of_drm_find_and_get_bridge() except it
does not increment the refcount. Rewrite it as a wrapper and put the bridge
being returned so the behaviour is still the same.

Reviewed-by: Maxime Ripard <mripard@kernel.org>
Link: https://patch.msgid.link/20251216-drm-bridge-alloc-getput-drm_of_find_bridge-v3-4-b5165fab8058@bootlin.com
Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>

+9 -11
+9 -11
drivers/gpu/drm/drm_bridge.c
··· 1529 1529 */ 1530 1530 struct drm_bridge *of_drm_find_bridge(struct device_node *np) 1531 1531 { 1532 - struct drm_bridge *bridge; 1532 + struct drm_bridge *bridge = of_drm_find_and_get_bridge(np); 1533 1533 1534 - mutex_lock(&bridge_lock); 1534 + /* 1535 + * We need to emulate the original semantics of 1536 + * of_drm_find_bridge(), which was not getting any bridge 1537 + * reference. Being now based on of_drm_find_and_get_bridge() which 1538 + * gets a reference, put it before returning. 1539 + */ 1540 + drm_bridge_put(bridge); 1535 1541 1536 - list_for_each_entry(bridge, &bridge_list, list) { 1537 - if (bridge->of_node == np) { 1538 - mutex_unlock(&bridge_lock); 1539 - return bridge; 1540 - } 1541 - } 1542 - 1543 - mutex_unlock(&bridge_lock); 1544 - return NULL; 1542 + return bridge; 1545 1543 } 1546 1544 EXPORT_SYMBOL(of_drm_find_bridge); 1547 1545 #endif