]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
mmc: host: s3cmci: no need to check return value of debugfs_create functions
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 12 Jun 2019 08:25:31 +0000 (10:25 +0200)
committerUlf Hansson <ulf.hansson@linaro.org>
Mon, 17 Jun 2019 11:31:29 +0000 (13:31 +0200)
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.

Also, because there is no need to save the file dentries, remove them
from the host-specific structure and just recursively delete the
directory that the driver created, when shutting down.

Cc: Ben Dooks <ben-linux@fluff.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
drivers/mmc/host/s3cmci.c
drivers/mmc/host/s3cmci.h

index f31333e831a70963c69b461239e795ab276eebc8..6a91db7ca5f14ee822d5ceb5141831b68a8627ac 100644 (file)
@@ -1452,33 +1452,18 @@ DEFINE_SHOW_ATTRIBUTE(s3cmci_regs);
 static void s3cmci_debugfs_attach(struct s3cmci_host *host)
 {
        struct device *dev = &host->pdev->dev;
+       struct dentry *root;
 
-       host->debug_root = debugfs_create_dir(dev_name(dev), NULL);
-       if (IS_ERR(host->debug_root)) {
-               dev_err(dev, "failed to create debugfs root\n");
-               return;
-       }
-
-       host->debug_state = debugfs_create_file("state", 0444,
-                                               host->debug_root, host,
-                                               &s3cmci_state_fops);
-
-       if (IS_ERR(host->debug_state))
-               dev_err(dev, "failed to create debug state file\n");
-
-       host->debug_regs = debugfs_create_file("regs", 0444,
-                                              host->debug_root, host,
-                                              &s3cmci_regs_fops);
+       root = debugfs_create_dir(dev_name(dev), NULL);
+       host->debug_root = root;
 
-       if (IS_ERR(host->debug_regs))
-               dev_err(dev, "failed to create debug regs file\n");
+       debugfs_create_file("state", 0444, root, host, &s3cmci_state_fops);
+       debugfs_create_file("regs", 0444, root, host, &s3cmci_regs_fops);
 }
 
 static void s3cmci_debugfs_remove(struct s3cmci_host *host)
 {
-       debugfs_remove(host->debug_regs);
-       debugfs_remove(host->debug_state);
-       debugfs_remove(host->debug_root);
+       debugfs_remove_recursive(host->debug_root);
 }
 
 #else
index 30c2c0dd1bc8acad424380ca7f22948557cb21d2..62cae53b42714350498364dc1ffb3d223f79fd9c 100644 (file)
@@ -70,8 +70,6 @@ struct s3cmci_host {
 
 #ifdef CONFIG_DEBUG_FS
        struct dentry           *debug_root;
-       struct dentry           *debug_state;
-       struct dentry           *debug_regs;
 #endif
 
 #ifdef CONFIG_ARM_S3C24XX_CPUFREQ