Skip to content

Commit 843635e

Browse files
Casey Leedomdavem330
authored andcommitted
cxgb4vf: Behave properly when CONFIG_DEBUG_FS isn't defined ...
When CONFIG_DEBUG_FS we get "ERR_PTR()"s back from the debugfs routines instead of NULL. Use the right predicates to check for this. Signed-off-by: Casey Leedom <leedom@chelsio.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent bb14a1a commit 843635e

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

drivers/net/cxgb4vf/cxgb4vf_main.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2040,7 +2040,7 @@ static int __devinit setup_debugfs(struct adapter *adapter)
20402040
{
20412041
int i;
20422042

2043-
BUG_ON(adapter->debugfs_root == NULL);
2043+
BUG_ON(IS_ERR_OR_NULL(adapter->debugfs_root));
20442044

20452045
/*
20462046
* Debugfs support is best effort.
@@ -2061,7 +2061,7 @@ static int __devinit setup_debugfs(struct adapter *adapter)
20612061
*/
20622062
static void cleanup_debugfs(struct adapter *adapter)
20632063
{
2064-
BUG_ON(adapter->debugfs_root == NULL);
2064+
BUG_ON(IS_ERR_OR_NULL(adapter->debugfs_root));
20652065

20662066
/*
20672067
* Unlike our sister routine cleanup_proc(), we don't need to remove
@@ -2700,11 +2700,11 @@ static int __devinit cxgb4vf_pci_probe(struct pci_dev *pdev,
27002700
/*
27012701
* Set up our debugfs entries.
27022702
*/
2703-
if (cxgb4vf_debugfs_root) {
2703+
if (!IS_ERR_OR_NULL(cxgb4vf_debugfs_root)) {
27042704
adapter->debugfs_root =
27052705
debugfs_create_dir(pci_name(pdev),
27062706
cxgb4vf_debugfs_root);
2707-
if (adapter->debugfs_root == NULL)
2707+
if (IS_ERR_OR_NULL(adapter->debugfs_root))
27082708
dev_warn(&pdev->dev, "could not create debugfs"
27092709
" directory");
27102710
else
@@ -2759,7 +2759,7 @@ static int __devinit cxgb4vf_pci_probe(struct pci_dev *pdev,
27592759
*/
27602760

27612761
err_free_debugfs:
2762-
if (adapter->debugfs_root) {
2762+
if (!IS_ERR_OR_NULL(adapter->debugfs_root)) {
27632763
cleanup_debugfs(adapter);
27642764
debugfs_remove_recursive(adapter->debugfs_root);
27652765
}
@@ -2828,7 +2828,7 @@ static void __devexit cxgb4vf_pci_remove(struct pci_dev *pdev)
28282828
/*
28292829
* Tear down our debugfs entries.
28302830
*/
2831-
if (adapter->debugfs_root) {
2831+
if (!IS_ERR_OR_NULL(adapter->debugfs_root)) {
28322832
cleanup_debugfs(adapter);
28332833
debugfs_remove_recursive(adapter->debugfs_root);
28342834
}
@@ -2916,12 +2916,12 @@ static int __init cxgb4vf_module_init(void)
29162916

29172917
/* Debugfs support is optional, just warn if this fails */
29182918
cxgb4vf_debugfs_root = debugfs_create_dir(KBUILD_MODNAME, NULL);
2919-
if (!cxgb4vf_debugfs_root)
2919+
if (IS_ERR_OR_NULL(cxgb4vf_debugfs_root))
29202920
printk(KERN_WARNING KBUILD_MODNAME ": could not create"
29212921
" debugfs entry, continuing\n");
29222922

29232923
ret = pci_register_driver(&cxgb4vf_driver);
2924-
if (ret < 0)
2924+
if (ret < 0 && !IS_ERR_OR_NULL(cxgb4vf_debugfs_root))
29252925
debugfs_remove(cxgb4vf_debugfs_root);
29262926
return ret;
29272927
}

0 commit comments

Comments
 (0)