Commit 8d72ab11 authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman Committed by David S. Miller

stmmac: 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.

Because we don't care about the individual files, we can remove the
stored dentry for the files, as they are not needed to be kept track of
at all.

Cc: Giuseppe Cavallaro <peppe.cavallaro@st.com>
Cc: Alexandre Torgue <alexandre.torgue@st.com>
Cc: Jose Abreu <joabreu@synopsys.com>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Maxime Coquelin <mcoquelin.stm32@gmail.com>
Cc: netdev@vger.kernel.org
Cc: linux-stm32@st-md-mailman.stormreply.com
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 16e9b481
...@@ -196,8 +196,6 @@ struct stmmac_priv { ...@@ -196,8 +196,6 @@ struct stmmac_priv {
#ifdef CONFIG_DEBUG_FS #ifdef CONFIG_DEBUG_FS
struct dentry *dbgfs_dir; struct dentry *dbgfs_dir;
struct dentry *dbgfs_rings_status;
struct dentry *dbgfs_dma_cap;
#endif #endif
unsigned long state; unsigned long state;
......
...@@ -105,7 +105,7 @@ MODULE_PARM_DESC(chain_mode, "To use chain instead of ring mode"); ...@@ -105,7 +105,7 @@ MODULE_PARM_DESC(chain_mode, "To use chain instead of ring mode");
static irqreturn_t stmmac_interrupt(int irq, void *dev_id); static irqreturn_t stmmac_interrupt(int irq, void *dev_id);
#ifdef CONFIG_DEBUG_FS #ifdef CONFIG_DEBUG_FS
static int stmmac_init_fs(struct net_device *dev); static void stmmac_init_fs(struct net_device *dev);
static void stmmac_exit_fs(struct net_device *dev); static void stmmac_exit_fs(struct net_device *dev);
#endif #endif
...@@ -3988,45 +3988,20 @@ static int stmmac_dma_cap_show(struct seq_file *seq, void *v) ...@@ -3988,45 +3988,20 @@ static int stmmac_dma_cap_show(struct seq_file *seq, void *v)
} }
DEFINE_SHOW_ATTRIBUTE(stmmac_dma_cap); DEFINE_SHOW_ATTRIBUTE(stmmac_dma_cap);
static int stmmac_init_fs(struct net_device *dev) static void stmmac_init_fs(struct net_device *dev)
{ {
struct stmmac_priv *priv = netdev_priv(dev); struct stmmac_priv *priv = netdev_priv(dev);
/* Create per netdev entries */ /* Create per netdev entries */
priv->dbgfs_dir = debugfs_create_dir(dev->name, stmmac_fs_dir); priv->dbgfs_dir = debugfs_create_dir(dev->name, stmmac_fs_dir);
if (!priv->dbgfs_dir || IS_ERR(priv->dbgfs_dir)) {
netdev_err(priv->dev, "ERROR failed to create debugfs directory\n");
return -ENOMEM;
}
/* Entry to report DMA RX/TX rings */ /* Entry to report DMA RX/TX rings */
priv->dbgfs_rings_status = debugfs_create_file("descriptors_status", 0444, priv->dbgfs_dir, dev,
debugfs_create_file("descriptors_status", 0444,
priv->dbgfs_dir, dev,
&stmmac_rings_status_fops); &stmmac_rings_status_fops);
if (!priv->dbgfs_rings_status || IS_ERR(priv->dbgfs_rings_status)) {
netdev_err(priv->dev, "ERROR creating stmmac ring debugfs file\n");
debugfs_remove_recursive(priv->dbgfs_dir);
return -ENOMEM;
}
/* Entry to report the DMA HW features */ /* Entry to report the DMA HW features */
priv->dbgfs_dma_cap = debugfs_create_file("dma_cap", 0444, debugfs_create_file("dma_cap", 0444, priv->dbgfs_dir, dev,
priv->dbgfs_dir, &stmmac_dma_cap_fops);
dev, &stmmac_dma_cap_fops);
if (!priv->dbgfs_dma_cap || IS_ERR(priv->dbgfs_dma_cap)) {
netdev_err(priv->dev, "ERROR creating stmmac MMC debugfs file\n");
debugfs_remove_recursive(priv->dbgfs_dir);
return -ENOMEM;
}
return 0;
} }
static void stmmac_exit_fs(struct net_device *dev) static void stmmac_exit_fs(struct net_device *dev)
...@@ -4482,10 +4457,7 @@ int stmmac_dvr_probe(struct device *device, ...@@ -4482,10 +4457,7 @@ int stmmac_dvr_probe(struct device *device,
} }
#ifdef CONFIG_DEBUG_FS #ifdef CONFIG_DEBUG_FS
ret = stmmac_init_fs(ndev); stmmac_init_fs(ndev);
if (ret < 0)
netdev_warn(priv->dev, "%s: failed debugFS registration\n",
__func__);
#endif #endif
return ret; return ret;
...@@ -4731,16 +4703,8 @@ static int __init stmmac_init(void) ...@@ -4731,16 +4703,8 @@ static int __init stmmac_init(void)
{ {
#ifdef CONFIG_DEBUG_FS #ifdef CONFIG_DEBUG_FS
/* Create debugfs main directory if it doesn't exist yet */ /* Create debugfs main directory if it doesn't exist yet */
if (!stmmac_fs_dir) { if (!stmmac_fs_dir)
stmmac_fs_dir = debugfs_create_dir(STMMAC_RESOURCE_NAME, NULL); stmmac_fs_dir = debugfs_create_dir(STMMAC_RESOURCE_NAME, NULL);
if (!stmmac_fs_dir || IS_ERR(stmmac_fs_dir)) {
pr_err("ERROR %s, debugfs create directory failed\n",
STMMAC_RESOURCE_NAME);
return -ENOMEM;
}
}
#endif #endif
return 0; return 0;
......
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