dmaengine: qcom: hidma: no need to check return value of debugfs_create functions
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 12 Jun 2019 12:25:57 +0000 (14:25 +0200)
committerVinod Koul <vkoul@kernel.org>
Fri, 14 Jun 2019 05:44:58 +0000 (11:14 +0530)
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 dentry, remove the
variables that were saving them as they were never even being used once
set.

Cc: Sinan Kaya <okaya@kernel.org>
Cc: Andy Gross <agross@kernel.org>
Cc: David Brown <david.brown@linaro.org>
Cc: Dan Williams <dan.j.williams@intel.com>
Cc: Vinod Koul <vkoul@kernel.org>
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-arm-msm@vger.kernel.org
Cc: dmaengine@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Acked-by: Sinan Kaya <okaya@kernel.org>
Signed-off-by: Vinod Koul <vkoul@kernel.org>
drivers/dma/qcom/hidma.h
drivers/dma/qcom/hidma_dbg.c

index 5f9966e82c0bc33dd0df45749190059322c097e9..36357d02333ac7ac41613bad55d8c95cee7c8506 100644 (file)
@@ -101,8 +101,6 @@ struct hidma_chan {
         * It is used by the DMA complete notification to
         * locate the descriptor that initiated the transfer.
         */
-       struct dentry                   *debugfs;
-       struct dentry                   *stats;
        struct hidma_dev                *dmadev;
        struct hidma_desc               *running;
 
@@ -134,7 +132,6 @@ struct hidma_dev {
        struct dma_device               ddev;
 
        struct dentry                   *debugfs;
-       struct dentry                   *stats;
 
        /* sysfs entry for the channel id */
        struct device_attribute         *chid_attrs;
@@ -166,6 +163,6 @@ irqreturn_t hidma_ll_inthandler(int irq, void *arg);
 irqreturn_t hidma_ll_inthandler_msi(int irq, void *arg, int cause);
 void hidma_cleanup_pending_tre(struct hidma_lldev *llhndl, u8 err_info,
                                u8 err_code);
-int hidma_debug_init(struct hidma_dev *dmadev);
+void hidma_debug_init(struct hidma_dev *dmadev);
 void hidma_debug_uninit(struct hidma_dev *dmadev);
 #endif
index 9523faf7acdcfeabb5244261afb02a123f364b61..994f448b64d8c0b229f94ae57dc6c13726d21b38 100644 (file)
@@ -146,17 +146,13 @@ void hidma_debug_uninit(struct hidma_dev *dmadev)
        debugfs_remove_recursive(dmadev->debugfs);
 }
 
-int hidma_debug_init(struct hidma_dev *dmadev)
+void hidma_debug_init(struct hidma_dev *dmadev)
 {
-       int rc = 0;
        int chidx = 0;
        struct list_head *position = NULL;
+       struct dentry *dir;
 
        dmadev->debugfs = debugfs_create_dir(dev_name(dmadev->ddev.dev), NULL);
-       if (!dmadev->debugfs) {
-               rc = -ENODEV;
-               return rc;
-       }
 
        /* walk through the virtual channel list */
        list_for_each(position, &dmadev->ddev.channels) {
@@ -165,32 +161,13 @@ int hidma_debug_init(struct hidma_dev *dmadev)
                chan = list_entry(position, struct hidma_chan,
                                  chan.device_node);
                sprintf(chan->dbg_name, "chan%d", chidx);
-               chan->debugfs = debugfs_create_dir(chan->dbg_name,
+               dir = debugfs_create_dir(chan->dbg_name,
                                                   dmadev->debugfs);
-               if (!chan->debugfs) {
-                       rc = -ENOMEM;
-                       goto cleanup;
-               }
-               chan->stats = debugfs_create_file("stats", S_IRUGO,
-                                                 chan->debugfs, chan,
-                                                 &hidma_chan_fops);
-               if (!chan->stats) {
-                       rc = -ENOMEM;
-                       goto cleanup;
-               }
+               debugfs_create_file("stats", S_IRUGO, dir, chan,
+                                   &hidma_chan_fops);
                chidx++;
        }
 
-       dmadev->stats = debugfs_create_file("stats", S_IRUGO,
-                                           dmadev->debugfs, dmadev,
-                                           &hidma_dma_fops);
-       if (!dmadev->stats) {
-               rc = -ENOMEM;
-               goto cleanup;
-       }
-
-       return 0;
-cleanup:
-       hidma_debug_uninit(dmadev);
-       return rc;
+       debugfs_create_file("stats", S_IRUGO, dmadev->debugfs, dmadev,
+                           &hidma_dma_fops);
 }