dma-buf: remove dma_buf directory on bufinfo file creation errors
authorMathias Krause <minipli@googlemail.com>
Sun, 19 Jun 2016 12:31:30 +0000 (14:31 +0200)
committerSumit Semwal <sumit.semwal@linaro.org>
Mon, 20 Jun 2016 16:56:36 +0000 (22:26 +0530)
Change the error handling in dma_buf_init_debugfs() to remove the
"dma_buf" directory if creating the "bufinfo" file fails. No need to
have an empty debugfs directory around.

Signed-off-by: Mathias Krause <minipli@googlemail.com>
Cc: Sumit Semwal <sumit.semwal@linaro.org>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Sumit Semwal <sumit.semwal@linaro.org>
drivers/dma-buf/dma-buf.c

index 7094b19bb4951ae89b0e85cbd999c35804a3ff76..f03e515611991b46a72a9718d18c60cb7dcc498e 100644 (file)
@@ -907,8 +907,11 @@ static int dma_buf_init_debugfs(void)
 
        err = dma_buf_debugfs_create_file("bufinfo", NULL);
 
-       if (err)
+       if (err) {
                pr_debug("dma_buf: debugfs: failed to create node bufinfo\n");
+               debugfs_remove_recursive(dma_buf_debugfs_dir);
+               dma_buf_debugfs_dir = NULL;
+       }
 
        return err;
 }