Commit 9e3926df authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman Committed by David S. Miller

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

This cleans up a lot of unneeded code and logic around the debugfs
files, making all of this much simpler and easier to understand.

Cc: Tom Lendacky <thomas.lendacky@amd.com>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: netdev@vger.kernel.org
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 9f818c8a
...@@ -438,7 +438,6 @@ static const struct file_operations xi2c_reg_value_fops = { ...@@ -438,7 +438,6 @@ static const struct file_operations xi2c_reg_value_fops = {
void xgbe_debugfs_init(struct xgbe_prv_data *pdata) void xgbe_debugfs_init(struct xgbe_prv_data *pdata)
{ {
struct dentry *pfile;
char *buf; char *buf;
/* Set defaults */ /* Set defaults */
...@@ -451,88 +450,48 @@ void xgbe_debugfs_init(struct xgbe_prv_data *pdata) ...@@ -451,88 +450,48 @@ void xgbe_debugfs_init(struct xgbe_prv_data *pdata)
return; return;
pdata->xgbe_debugfs = debugfs_create_dir(buf, NULL); pdata->xgbe_debugfs = debugfs_create_dir(buf, NULL);
if (!pdata->xgbe_debugfs) {
netdev_err(pdata->netdev, "debugfs_create_dir failed\n");
kfree(buf);
return;
}
pfile = debugfs_create_file("xgmac_register", 0600, debugfs_create_file("xgmac_register", 0600, pdata->xgbe_debugfs, pdata,
pdata->xgbe_debugfs, pdata, &xgmac_reg_addr_fops);
&xgmac_reg_addr_fops);
if (!pfile)
netdev_err(pdata->netdev, "debugfs_create_file failed\n");
pfile = debugfs_create_file("xgmac_register_value", 0600, debugfs_create_file("xgmac_register_value", 0600, pdata->xgbe_debugfs,
pdata->xgbe_debugfs, pdata, pdata, &xgmac_reg_value_fops);
&xgmac_reg_value_fops);
if (!pfile)
netdev_err(pdata->netdev, "debugfs_create_file failed\n");
pfile = debugfs_create_file("xpcs_mmd", 0600, debugfs_create_file("xpcs_mmd", 0600, pdata->xgbe_debugfs, pdata,
pdata->xgbe_debugfs, pdata, &xpcs_mmd_fops);
&xpcs_mmd_fops);
if (!pfile)
netdev_err(pdata->netdev, "debugfs_create_file failed\n");
pfile = debugfs_create_file("xpcs_register", 0600, debugfs_create_file("xpcs_register", 0600, pdata->xgbe_debugfs, pdata,
pdata->xgbe_debugfs, pdata, &xpcs_reg_addr_fops);
&xpcs_reg_addr_fops);
if (!pfile)
netdev_err(pdata->netdev, "debugfs_create_file failed\n");
pfile = debugfs_create_file("xpcs_register_value", 0600, debugfs_create_file("xpcs_register_value", 0600, pdata->xgbe_debugfs,
pdata->xgbe_debugfs, pdata, pdata, &xpcs_reg_value_fops);
&xpcs_reg_value_fops);
if (!pfile)
netdev_err(pdata->netdev, "debugfs_create_file failed\n");
if (pdata->xprop_regs) { if (pdata->xprop_regs) {
pfile = debugfs_create_file("xprop_register", 0600, debugfs_create_file("xprop_register", 0600, pdata->xgbe_debugfs,
pdata->xgbe_debugfs, pdata, pdata, &xprop_reg_addr_fops);
&xprop_reg_addr_fops);
if (!pfile) debugfs_create_file("xprop_register_value", 0600,
netdev_err(pdata->netdev, pdata->xgbe_debugfs, pdata,
"debugfs_create_file failed\n"); &xprop_reg_value_fops);
pfile = debugfs_create_file("xprop_register_value", 0600,
pdata->xgbe_debugfs, pdata,
&xprop_reg_value_fops);
if (!pfile)
netdev_err(pdata->netdev,
"debugfs_create_file failed\n");
} }
if (pdata->xi2c_regs) { if (pdata->xi2c_regs) {
pfile = debugfs_create_file("xi2c_register", 0600, debugfs_create_file("xi2c_register", 0600, pdata->xgbe_debugfs,
pdata->xgbe_debugfs, pdata, pdata, &xi2c_reg_addr_fops);
&xi2c_reg_addr_fops);
if (!pfile) debugfs_create_file("xi2c_register_value", 0600,
netdev_err(pdata->netdev, pdata->xgbe_debugfs, pdata,
"debugfs_create_file failed\n"); &xi2c_reg_value_fops);
pfile = debugfs_create_file("xi2c_register_value", 0600,
pdata->xgbe_debugfs, pdata,
&xi2c_reg_value_fops);
if (!pfile)
netdev_err(pdata->netdev,
"debugfs_create_file failed\n");
} }
if (pdata->vdata->an_cdr_workaround) { if (pdata->vdata->an_cdr_workaround) {
pfile = debugfs_create_bool("an_cdr_workaround", 0600, debugfs_create_bool("an_cdr_workaround", 0600,
pdata->xgbe_debugfs, pdata->xgbe_debugfs,
&pdata->debugfs_an_cdr_workaround); &pdata->debugfs_an_cdr_workaround);
if (!pfile)
netdev_err(pdata->netdev, debugfs_create_bool("an_cdr_track_early", 0600,
"debugfs_create_bool failed\n"); pdata->xgbe_debugfs,
&pdata->debugfs_an_cdr_track_early);
pfile = debugfs_create_bool("an_cdr_track_early", 0600,
pdata->xgbe_debugfs,
&pdata->debugfs_an_cdr_track_early);
if (!pfile)
netdev_err(pdata->netdev,
"debugfs_create_bool failed\n");
} }
kfree(buf); kfree(buf);
...@@ -546,7 +505,6 @@ void xgbe_debugfs_exit(struct xgbe_prv_data *pdata) ...@@ -546,7 +505,6 @@ void xgbe_debugfs_exit(struct xgbe_prv_data *pdata)
void xgbe_debugfs_rename(struct xgbe_prv_data *pdata) void xgbe_debugfs_rename(struct xgbe_prv_data *pdata)
{ {
struct dentry *pfile;
char *buf; char *buf;
if (!pdata->xgbe_debugfs) if (!pdata->xgbe_debugfs)
...@@ -559,11 +517,8 @@ void xgbe_debugfs_rename(struct xgbe_prv_data *pdata) ...@@ -559,11 +517,8 @@ void xgbe_debugfs_rename(struct xgbe_prv_data *pdata)
if (!strcmp(pdata->xgbe_debugfs->d_name.name, buf)) if (!strcmp(pdata->xgbe_debugfs->d_name.name, buf))
goto out; goto out;
pfile = debugfs_rename(pdata->xgbe_debugfs->d_parent, debugfs_rename(pdata->xgbe_debugfs->d_parent, pdata->xgbe_debugfs,
pdata->xgbe_debugfs, pdata->xgbe_debugfs->d_parent, buf);
pdata->xgbe_debugfs->d_parent, buf);
if (!pfile)
netdev_err(pdata->netdev, "debugfs_rename failed\n");
out: out:
kfree(buf); kfree(buf);
......
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