powerpc/powernv/vas: Fix order of cleanup in vas_window_init_dbgdir()
authorSukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
Wed, 20 Dec 2017 01:10:29 +0000 (17:10 -0800)
committerMichael Ellerman <mpe@ellerman.id.au>
Tue, 13 Mar 2018 04:10:15 +0000 (15:10 +1100)
Fix the order of cleanup to ensure we free the name buffer in case
of an error creating 'hvwc' or 'info' files.

Signed-off-by: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
arch/powerpc/platforms/powernv/vas-debug.c

index ca22f1eae050d25d4aef64f1db31f0f10b5641d4..b4de4c6fd38b34979c4531f667cab207f5f73642 100644 (file)
@@ -166,13 +166,13 @@ void vas_window_init_dbgdir(struct vas_window *window)
 
        return;
 
-free_name:
-       kfree(window->dbgname);
-       window->dbgname = NULL;
-
 remove_dir:
        debugfs_remove_recursive(window->dbgdir);
        window->dbgdir = NULL;
+
+free_name:
+       kfree(window->dbgname);
+       window->dbgname = NULL;
 }
 
 void vas_instance_init_dbgdir(struct vas_instance *vinst)