diff options
author | Casey Leedom <leedom@chelsio.com> | 2011-02-14 07:56:23 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-02-14 20:37:10 -0500 |
commit | 843635e0349be9e318be224d6241069a40e23320 (patch) | |
tree | 2e90bffcf79352627f13af089e5b9d7bd1f3faa0 /drivers/net/cxgb4vf | |
parent | bb14a1af86d01f66dc9620725ac00a240331afec (diff) |
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>
Diffstat (limited to 'drivers/net/cxgb4vf')
-rw-r--r-- | drivers/net/cxgb4vf/cxgb4vf_main.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/drivers/net/cxgb4vf/cxgb4vf_main.c b/drivers/net/cxgb4vf/cxgb4vf_main.c index 072b64e49370..2be1088ff601 100644 --- a/drivers/net/cxgb4vf/cxgb4vf_main.c +++ b/drivers/net/cxgb4vf/cxgb4vf_main.c | |||
@@ -2040,7 +2040,7 @@ static int __devinit setup_debugfs(struct adapter *adapter) | |||
2040 | { | 2040 | { |
2041 | int i; | 2041 | int i; |
2042 | 2042 | ||
2043 | BUG_ON(adapter->debugfs_root == NULL); | 2043 | BUG_ON(IS_ERR_OR_NULL(adapter->debugfs_root)); |
2044 | 2044 | ||
2045 | /* | 2045 | /* |
2046 | * Debugfs support is best effort. | 2046 | * Debugfs support is best effort. |
@@ -2061,7 +2061,7 @@ static int __devinit setup_debugfs(struct adapter *adapter) | |||
2061 | */ | 2061 | */ |
2062 | static void cleanup_debugfs(struct adapter *adapter) | 2062 | static void cleanup_debugfs(struct adapter *adapter) |
2063 | { | 2063 | { |
2064 | BUG_ON(adapter->debugfs_root == NULL); | 2064 | BUG_ON(IS_ERR_OR_NULL(adapter->debugfs_root)); |
2065 | 2065 | ||
2066 | /* | 2066 | /* |
2067 | * Unlike our sister routine cleanup_proc(), we don't need to remove | 2067 | * 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, | |||
2700 | /* | 2700 | /* |
2701 | * Set up our debugfs entries. | 2701 | * Set up our debugfs entries. |
2702 | */ | 2702 | */ |
2703 | if (cxgb4vf_debugfs_root) { | 2703 | if (!IS_ERR_OR_NULL(cxgb4vf_debugfs_root)) { |
2704 | adapter->debugfs_root = | 2704 | adapter->debugfs_root = |
2705 | debugfs_create_dir(pci_name(pdev), | 2705 | debugfs_create_dir(pci_name(pdev), |
2706 | cxgb4vf_debugfs_root); | 2706 | cxgb4vf_debugfs_root); |
2707 | if (adapter->debugfs_root == NULL) | 2707 | if (IS_ERR_OR_NULL(adapter->debugfs_root)) |
2708 | dev_warn(&pdev->dev, "could not create debugfs" | 2708 | dev_warn(&pdev->dev, "could not create debugfs" |
2709 | " directory"); | 2709 | " directory"); |
2710 | else | 2710 | else |
@@ -2759,7 +2759,7 @@ static int __devinit cxgb4vf_pci_probe(struct pci_dev *pdev, | |||
2759 | */ | 2759 | */ |
2760 | 2760 | ||
2761 | err_free_debugfs: | 2761 | err_free_debugfs: |
2762 | if (adapter->debugfs_root) { | 2762 | if (!IS_ERR_OR_NULL(adapter->debugfs_root)) { |
2763 | cleanup_debugfs(adapter); | 2763 | cleanup_debugfs(adapter); |
2764 | debugfs_remove_recursive(adapter->debugfs_root); | 2764 | debugfs_remove_recursive(adapter->debugfs_root); |
2765 | } | 2765 | } |
@@ -2828,7 +2828,7 @@ static void __devexit cxgb4vf_pci_remove(struct pci_dev *pdev) | |||
2828 | /* | 2828 | /* |
2829 | * Tear down our debugfs entries. | 2829 | * Tear down our debugfs entries. |
2830 | */ | 2830 | */ |
2831 | if (adapter->debugfs_root) { | 2831 | if (!IS_ERR_OR_NULL(adapter->debugfs_root)) { |
2832 | cleanup_debugfs(adapter); | 2832 | cleanup_debugfs(adapter); |
2833 | debugfs_remove_recursive(adapter->debugfs_root); | 2833 | debugfs_remove_recursive(adapter->debugfs_root); |
2834 | } | 2834 | } |
@@ -2916,12 +2916,12 @@ static int __init cxgb4vf_module_init(void) | |||
2916 | 2916 | ||
2917 | /* Debugfs support is optional, just warn if this fails */ | 2917 | /* Debugfs support is optional, just warn if this fails */ |
2918 | cxgb4vf_debugfs_root = debugfs_create_dir(KBUILD_MODNAME, NULL); | 2918 | cxgb4vf_debugfs_root = debugfs_create_dir(KBUILD_MODNAME, NULL); |
2919 | if (!cxgb4vf_debugfs_root) | 2919 | if (IS_ERR_OR_NULL(cxgb4vf_debugfs_root)) |
2920 | printk(KERN_WARNING KBUILD_MODNAME ": could not create" | 2920 | printk(KERN_WARNING KBUILD_MODNAME ": could not create" |
2921 | " debugfs entry, continuing\n"); | 2921 | " debugfs entry, continuing\n"); |
2922 | 2922 | ||
2923 | ret = pci_register_driver(&cxgb4vf_driver); | 2923 | ret = pci_register_driver(&cxgb4vf_driver); |
2924 | if (ret < 0) | 2924 | if (ret < 0 && !IS_ERR_OR_NULL(cxgb4vf_debugfs_root)) |
2925 | debugfs_remove(cxgb4vf_debugfs_root); | 2925 | debugfs_remove(cxgb4vf_debugfs_root); |
2926 | return ret; | 2926 | return ret; |
2927 | } | 2927 | } |