powerpc/perf: Fix double unlock in imc_common_cpuhp_mem_free()
authorDan Carpenter <dan.carpenter@oracle.com>
Fri, 11 Aug 2017 20:05:41 +0000 (23:05 +0300)
committerMichael Ellerman <mpe@ellerman.id.au>
Mon, 14 Aug 2017 11:57:55 +0000 (21:57 +1000)
This function is not called with the nest_init_lock held, and it also
unlocks the nest_init_lock immediately below, so it's fairly clear
that this is a typo and should be locking the lock.

Fixes: 885dcd709ba9 ("powerpc/perf: Add nest IMC PMU support")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
arch/powerpc/perf/imc-pmu.c

index 46cd912af060c0204d1dbcc07e88d444ea480aca..52017f6eafd9151d1bf534e94a7ba335133d636a 100644 (file)
@@ -1124,7 +1124,7 @@ static void cleanup_all_thread_imc_memory(void)
 static void imc_common_cpuhp_mem_free(struct imc_pmu *pmu_ptr)
 {
        if (pmu_ptr->domain == IMC_DOMAIN_NEST) {
-               mutex_unlock(&nest_init_lock);
+               mutex_lock(&nest_init_lock);
                if (nest_pmus == 1) {
                        cpuhp_remove_state(CPUHP_AP_PERF_POWERPC_NEST_IMC_ONLINE);
                        kfree(nest_imc_refc);