of/unittest: Missing unlocks on error
authorDan Carpenter <dan.carpenter@oracle.com>
Wed, 3 May 2017 19:49:50 +0000 (22:49 +0300)
committerRob Herring <robh@kernel.org>
Thu, 4 May 2017 16:07:38 +0000 (11:07 -0500)
Static checkers complain that we should unlock before returning.  Which
is true.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Frank Rowand <frank.rowand@sony.com>
Signed-off-by: Rob Herring <robh@kernel.org>
drivers/of/unittest.c

index 6b8f3e6aa43c2c144d207b49bc69a0e25e223139..987a1530282ac6a930ddb2da2c46239d02d91def 100644 (file)
@@ -2210,14 +2210,14 @@ static __init void of_unittest_overlay_high_level(void)
                                unittest(0,
                                         "duplicate property '%s' in overlay_base node __symbols__",
                                         prop->name);
-                               return;
+                               goto err_unlock;
                        }
                        ret = __of_add_property_sysfs(of_symbols, prop);
                        if (ret) {
                                unittest(0,
                                         "unable to add property '%s' in overlay_base node __symbols__ to sysfs",
                                         prop->name);
-                               return;
+                               goto err_unlock;
                        }
                }
        }
@@ -2232,6 +2232,10 @@ static __init void of_unittest_overlay_high_level(void)
 
        unittest(overlay_data_add(2),
                 "Adding overlay 'overlay_bad_phandle' failed\n");
+       return;
+
+err_unlock:
+       mutex_unlock(&of_mutex);
 }
 
 #else