Commit a04c50aa authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman Committed by Ulf Hansson

mmc: core: no need to check return value of debugfs_create functions

When calling debugfs functions, there is no need to ever check the
return value.  The function can work or not, but the code logic should
never do something different based on this.
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
parent 163367c9
...@@ -230,45 +230,21 @@ void mmc_add_host_debugfs(struct mmc_host *host) ...@@ -230,45 +230,21 @@ void mmc_add_host_debugfs(struct mmc_host *host)
struct dentry *root; struct dentry *root;
root = debugfs_create_dir(mmc_hostname(host), NULL); root = debugfs_create_dir(mmc_hostname(host), NULL);
if (IS_ERR(root))
/* Don't complain -- debugfs just isn't enabled */
return;
if (!root)
/* Complain -- debugfs is enabled, but it failed to
* create the directory. */
goto err_root;
host->debugfs_root = root; host->debugfs_root = root;
if (!debugfs_create_file("ios", S_IRUSR, root, host, &mmc_ios_fops)) debugfs_create_file("ios", S_IRUSR, root, host, &mmc_ios_fops);
goto err_node; debugfs_create_x32("caps", S_IRUSR, root, &host->caps);
debugfs_create_x32("caps2", S_IRUSR, root, &host->caps2);
if (!debugfs_create_x32("caps", S_IRUSR, root, &host->caps)) debugfs_create_file("clock", S_IRUSR | S_IWUSR, root, host,
goto err_node; &mmc_clock_fops);
if (!debugfs_create_x32("caps2", S_IRUSR, root, &host->caps2))
goto err_node;
if (!debugfs_create_file("clock", S_IRUSR | S_IWUSR, root, host,
&mmc_clock_fops))
goto err_node;
#ifdef CONFIG_FAIL_MMC_REQUEST #ifdef CONFIG_FAIL_MMC_REQUEST
if (fail_request) if (fail_request)
setup_fault_attr(&fail_default_attr, fail_request); setup_fault_attr(&fail_default_attr, fail_request);
host->fail_mmc_request = fail_default_attr; host->fail_mmc_request = fail_default_attr;
if (IS_ERR(fault_create_debugfs_attr("fail_mmc_request", fault_create_debugfs_attr("fail_mmc_request", root,
root, &host->fail_mmc_request);
&host->fail_mmc_request)))
goto err_node;
#endif #endif
return;
err_node:
debugfs_remove_recursive(root);
host->debugfs_root = NULL;
err_root:
dev_err(&host->class_dev, "failed to initialize debugfs\n");
} }
void mmc_remove_host_debugfs(struct mmc_host *host) void mmc_remove_host_debugfs(struct mmc_host *host)
...@@ -285,25 +261,9 @@ void mmc_add_card_debugfs(struct mmc_card *card) ...@@ -285,25 +261,9 @@ void mmc_add_card_debugfs(struct mmc_card *card)
return; return;
root = debugfs_create_dir(mmc_card_id(card), host->debugfs_root); root = debugfs_create_dir(mmc_card_id(card), host->debugfs_root);
if (IS_ERR(root))
/* Don't complain -- debugfs just isn't enabled */
return;
if (!root)
/* Complain -- debugfs is enabled, but it failed to
* create the directory. */
goto err;
card->debugfs_root = root; card->debugfs_root = root;
if (!debugfs_create_x32("state", S_IRUSR, root, &card->state)) debugfs_create_x32("state", S_IRUSR, root, &card->state);
goto err;
return;
err:
debugfs_remove_recursive(root);
card->debugfs_root = NULL;
dev_err(&card->dev, "failed to initialize debugfs\n");
} }
void mmc_remove_card_debugfs(struct mmc_card *card) void mmc_remove_card_debugfs(struct mmc_card *card)
......
...@@ -3167,15 +3167,7 @@ static int __mmc_test_register_dbgfs_file(struct mmc_card *card, ...@@ -3167,15 +3167,7 @@ static int __mmc_test_register_dbgfs_file(struct mmc_card *card,
struct mmc_test_dbgfs_file *df; struct mmc_test_dbgfs_file *df;
if (card->debugfs_root) if (card->debugfs_root)
file = debugfs_create_file(name, mode, card->debugfs_root, debugfs_create_file(name, mode, card->debugfs_root, card, fops);
card, fops);
if (IS_ERR_OR_NULL(file)) {
dev_err(&card->dev,
"Can't create %s. Perhaps debugfs is disabled.\n",
name);
return -ENODEV;
}
df = kmalloc(sizeof(*df), GFP_KERNEL); df = kmalloc(sizeof(*df), GFP_KERNEL);
if (!df) { if (!df) {
......
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