clk: rockchip: rk3288: fix up the clk register for hclk_vio
[firefly-linux-kernel-4.4.55.git] / drivers / usb / gadget / configfs.c
index b27ce0747c188d95a52a9dee5fa14f00b66f7e76..54849fe9cb01ed8c6b64ebfc3c3e08edd243af89 100644 (file)
@@ -425,11 +425,6 @@ static int config_usb_cfg_link(
        }
 
        f = usb_get_function(fi);
-       if (f == NULL) {
-               /* Are we trying to symlink PTP without MTP function? */
-               ret = -EINVAL; /* Invalid Configuration */
-               goto out;
-       }
        if (IS_ERR(f)) {
                ret = PTR_ERR(f);
                goto out;
@@ -1737,7 +1732,9 @@ void unregister_gadget_item(struct config_item *item)
 {
        struct gadget_info *gi = to_gadget_info(item);
 
+       mutex_lock(&gi->lock);
        unregister_gadget(gi);
+       mutex_unlock(&gi->lock);
 }
 EXPORT_SYMBOL_GPL(unregister_gadget_item);