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

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

If a debugfs call fails, it will properly warn in the syslog, there's no
need for all individual drivers to also print a message, so that is one
more reason to not care about checking the return values.

Cc: Vishal Kulkarni <vishal@chelsio.com>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Casey Leedom <leedom@chelsio.com>
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 3a131e85
...@@ -3529,7 +3529,6 @@ int t4_setup_debugfs(struct adapter *adap) ...@@ -3529,7 +3529,6 @@ int t4_setup_debugfs(struct adapter *adap)
{ {
int i; int i;
u32 size = 0; u32 size = 0;
struct dentry *de;
static struct t4_debugfs_entry t4_debugfs_files[] = { static struct t4_debugfs_entry t4_debugfs_files[] = {
{ "cim_la", &cim_la_fops, 0400, 0 }, { "cim_la", &cim_la_fops, 0400, 0 },
...@@ -3640,7 +3639,7 @@ int t4_setup_debugfs(struct adapter *adap) ...@@ -3640,7 +3639,7 @@ int t4_setup_debugfs(struct adapter *adap)
} }
} }
de = debugfs_create_file_size("flash", 0400, adap->debugfs_root, adap, debugfs_create_file_size("flash", 0400, adap->debugfs_root, adap,
&flash_debugfs_fops, adap->params.sf_size); &flash_debugfs_fops, adap->params.sf_size);
debugfs_create_bool("use_backdoor", 0600, debugfs_create_bool("use_backdoor", 0600,
adap->debugfs_root, &adap->use_bd); adap->debugfs_root, &adap->use_bd);
......
...@@ -6269,10 +6269,7 @@ static int __init cxgb4_init_module(void) ...@@ -6269,10 +6269,7 @@ static int __init cxgb4_init_module(void)
{ {
int ret; int ret;
/* Debugfs support is optional, just warn if this fails */
cxgb4_debugfs_root = debugfs_create_dir(KBUILD_MODNAME, NULL); cxgb4_debugfs_root = debugfs_create_dir(KBUILD_MODNAME, NULL);
if (!cxgb4_debugfs_root)
pr_warn("could not create debugfs entry, continuing\n");
ret = pci_register_driver(&cxgb4_driver); ret = pci_register_driver(&cxgb4_driver);
if (ret < 0) if (ret < 0)
......
...@@ -2478,10 +2478,9 @@ static int setup_debugfs(struct adapter *adapter) ...@@ -2478,10 +2478,9 @@ static int setup_debugfs(struct adapter *adapter)
* Debugfs support is best effort. * Debugfs support is best effort.
*/ */
for (i = 0; i < ARRAY_SIZE(debugfs_files); i++) for (i = 0; i < ARRAY_SIZE(debugfs_files); i++)
(void)debugfs_create_file(debugfs_files[i].name, debugfs_create_file(debugfs_files[i].name,
debugfs_files[i].mode, debugfs_files[i].mode,
adapter->debugfs_root, adapter->debugfs_root, (void *)adapter,
(void *)adapter,
debugfs_files[i].fops); debugfs_files[i].fops);
return 0; return 0;
...@@ -3257,10 +3256,6 @@ static int cxgb4vf_pci_probe(struct pci_dev *pdev, ...@@ -3257,10 +3256,6 @@ static int cxgb4vf_pci_probe(struct pci_dev *pdev,
adapter->debugfs_root = adapter->debugfs_root =
debugfs_create_dir(pci_name(pdev), debugfs_create_dir(pci_name(pdev),
cxgb4vf_debugfs_root); cxgb4vf_debugfs_root);
if (IS_ERR_OR_NULL(adapter->debugfs_root))
dev_warn(&pdev->dev, "could not create debugfs"
" directory");
else
setup_debugfs(adapter); setup_debugfs(adapter);
} }
...@@ -3486,13 +3481,11 @@ static int __init cxgb4vf_module_init(void) ...@@ -3486,13 +3481,11 @@ static int __init cxgb4vf_module_init(void)
return -EINVAL; return -EINVAL;
} }
/* Debugfs support is optional, just warn if this fails */ /* Debugfs support is optional, debugfs will warn if this fails */
cxgb4vf_debugfs_root = debugfs_create_dir(KBUILD_MODNAME, NULL); cxgb4vf_debugfs_root = debugfs_create_dir(KBUILD_MODNAME, NULL);
if (IS_ERR_OR_NULL(cxgb4vf_debugfs_root))
pr_warn("could not create debugfs entry, continuing\n");
ret = pci_register_driver(&cxgb4vf_driver); ret = pci_register_driver(&cxgb4vf_driver);
if (ret < 0 && !IS_ERR_OR_NULL(cxgb4vf_debugfs_root)) if (ret < 0)
debugfs_remove(cxgb4vf_debugfs_root); debugfs_remove(cxgb4vf_debugfs_root);
return ret; return ret;
} }
......
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