staging: most: move mutex
authorChristian Gromm <christian.gromm@microchip.com>
Tue, 22 Dec 2015 09:52:54 +0000 (10:52 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 8 Feb 2016 01:34:58 +0000 (17:34 -0800)
This patch removes mutex from code that doesn't need any locking.

Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/most/mostcore/core.c

index 21c550ccfe7801ab299ae617e861b59772e40730..ae1b5778b24bd020712f81e1ab4a11efa6c8c97e 100644 (file)
@@ -1830,15 +1830,14 @@ void most_deregister_interface(struct most_interface *iface)
        struct most_inst_obj *i = iface->priv;
        struct most_c_obj *c;
 
-       mutex_lock(&deregister_mutex);
        if (unlikely(!i)) {
                pr_info("Bad Interface\n");
-               mutex_unlock(&deregister_mutex);
                return;
        }
        pr_info("deregistering MOST device %s (%s)\n", i->kobj.name,
                iface->description);
 
+       mutex_lock(&deregister_mutex);
        atomic_set(&i->tainted, 1);
        mutex_unlock(&deregister_mutex);