From: Luca Ceresoli Date: Tue, 24 Mar 2026 09:08:49 +0000 (+0100) Subject: drm/bridge: drm_bridge_get/put(): document NULL pointer behaviour X-Git-Tag: v7.2-rc1~141^2~26^2~119 X-Git-Url: http://git.ipfire.org/gitweb/?a=commitdiff_plain;h=af29fcbe806ecd10078c406470fecb902b3c0e55;p=thirdparty%2Flinux.git drm/bridge: drm_bridge_get/put(): document NULL pointer behaviour drm_bridge_get and drm_bridge_put() do nothing when they are passed a NULL pointer, and they do so since their initial addition in commit 30d1b37d4c02 ("drm/bridge: add support for refcounting"). This allows simpler code in various places when using these functions. However it's not documented, so it's not clear whether it is part of the API "contract" or just a current implementation detail that might change in the future. There is no visible reason to remove this NULL check, so document it, making it part of the contract, letting users count on it. Reviewed-by: Liu Ying Reviewed-by: Louis Chauvet Link: https://patch.msgid.link/20260324-drm-bridge-alloc-getput-document-null-check-v1-1-fb0877c49d7e@bootlin.com Signed-off-by: Luca Ceresoli --- diff --git a/drivers/gpu/drm/drm_bridge.c b/drivers/gpu/drm/drm_bridge.c index d6f512b733896..ba80bebb56856 100644 --- a/drivers/gpu/drm/drm_bridge.c +++ b/drivers/gpu/drm/drm_bridge.c @@ -282,7 +282,7 @@ static void __drm_bridge_free(struct kref *kref) /** * drm_bridge_get - Acquire a bridge reference - * @bridge: DRM bridge + * @bridge: DRM bridge; if NULL this function does nothing * * This function increments the bridge's refcount. * @@ -300,7 +300,7 @@ EXPORT_SYMBOL(drm_bridge_get); /** * drm_bridge_put - Release a bridge reference - * @bridge: DRM bridge + * @bridge: DRM bridge; if NULL this function does nothing * * This function decrements the bridge's reference count and frees the * object if the reference count drops to zero.