Re: [PATCH] drm/drm_bridge: adjust bridge module's refcount

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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);

_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/dri-devel




[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux