[PATCH] drm/drm_bridge: adjust bridge module's refcount
Jyri Sarha
jsarha at ti.com
Tue Nov 29 21:30:55 UTC 2016
On 11/29/16 23:12, Jyri Sarha wrote:
> @@ -114,6 +118,9 @@ int drm_bridge_attach(struct drm_device *dev, struct drm_bridge *bridge)
> if (bridge->dev)
> return -EBUSY;
>
> + if (!try_module_get(bridge->module))
> + return -ENOENT;
> +
> bridge->dev = dev;
>
> if (bridge->funcs->attach)
This sill needs:
- if (bridge->funcs->attach)
- return bridge->funcs->attach(bridge);
+ if (bridge->funcs->attach) {
+ int ret = bridge->funcs->attach(bridge);
+
+ if (ret) {
+ module_put(bridge->module);
+ return ret;
+ }
+ }
> @@ -144,6 +151,8 @@ void drm_bridge_detach(struct drm_bridge *bridge)
> if (bridge->funcs->detach)
> bridge->funcs->detach(bridge);
>
> + module_put(bridge->module);
> +
> bridge->dev = NULL;
> }
> EXPORT_SYMBOL(drm_bridge_detach);
More information about the dri-devel
mailing list