Commit 33460b2d authored by Gary R Hook's avatar Gary R Hook Committed by Herbert Xu

crypto: ccp - Provide an error path for debugfs setup failure

Changes since v2:
  - On failure remove only the DebugFS heirarchy for this device
Changes since v1:
  - Remove unneeded local variable
Signed-off-by: default avatarGary R Hook <gary.hook@amd.com>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent bce386af
...@@ -305,19 +305,19 @@ void ccp5_debugfs_setup(struct ccp_device *ccp) ...@@ -305,19 +305,19 @@ void ccp5_debugfs_setup(struct ccp_device *ccp)
ccp->debugfs_instance = debugfs_create_dir(ccp->name, ccp_debugfs_dir); ccp->debugfs_instance = debugfs_create_dir(ccp->name, ccp_debugfs_dir);
if (!ccp->debugfs_instance) if (!ccp->debugfs_instance)
return; goto err;
debugfs_info = debugfs_create_file("info", 0400, debugfs_info = debugfs_create_file("info", 0400,
ccp->debugfs_instance, ccp, ccp->debugfs_instance, ccp,
&ccp_debugfs_info_ops); &ccp_debugfs_info_ops);
if (!debugfs_info) if (!debugfs_info)
return; goto err;
debugfs_stats = debugfs_create_file("stats", 0600, debugfs_stats = debugfs_create_file("stats", 0600,
ccp->debugfs_instance, ccp, ccp->debugfs_instance, ccp,
&ccp_debugfs_stats_ops); &ccp_debugfs_stats_ops);
if (!debugfs_stats) if (!debugfs_stats)
return; goto err;
for (i = 0; i < ccp->cmd_q_count; i++) { for (i = 0; i < ccp->cmd_q_count; i++) {
cmd_q = &ccp->cmd_q[i]; cmd_q = &ccp->cmd_q[i];
...@@ -327,15 +327,20 @@ void ccp5_debugfs_setup(struct ccp_device *ccp) ...@@ -327,15 +327,20 @@ void ccp5_debugfs_setup(struct ccp_device *ccp)
debugfs_q_instance = debugfs_q_instance =
debugfs_create_dir(name, ccp->debugfs_instance); debugfs_create_dir(name, ccp->debugfs_instance);
if (!debugfs_q_instance) if (!debugfs_q_instance)
return; goto err;
debugfs_q_stats = debugfs_q_stats =
debugfs_create_file("stats", 0600, debugfs_create_file("stats", 0600,
debugfs_q_instance, cmd_q, debugfs_q_instance, cmd_q,
&ccp_debugfs_queue_ops); &ccp_debugfs_queue_ops);
if (!debugfs_q_stats) if (!debugfs_q_stats)
return; goto err;
} }
return;
err:
debugfs_remove_recursive(ccp->debugfs_instance);
} }
void ccp5_debugfs_destroy(void) void ccp5_debugfs_destroy(void)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment