@@ -2040,7 +2040,7 @@ static int __devinit setup_debugfs(struct adapter *adapter)
2040
2040
{
2041
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
2046
* Debugfs support is best effort.
@@ -2061,7 +2061,7 @@ static int __devinit setup_debugfs(struct adapter *adapter)
2061
2061
*/
2062
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
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
2701
* Set up our debugfs entries.
2702
2702
*/
2703
- if (cxgb4vf_debugfs_root ) {
2703
+ if (! IS_ERR_OR_NULL ( cxgb4vf_debugfs_root ) ) {
2704
2704
adapter -> debugfs_root =
2705
2705
debugfs_create_dir (pci_name (pdev ),
2706
2706
cxgb4vf_debugfs_root );
2707
- if (adapter -> debugfs_root == NULL )
2707
+ if (IS_ERR_OR_NULL ( adapter -> debugfs_root ) )
2708
2708
dev_warn (& pdev -> dev , "could not create debugfs"
2709
2709
" directory" );
2710
2710
else
@@ -2759,7 +2759,7 @@ static int __devinit cxgb4vf_pci_probe(struct pci_dev *pdev,
2759
2759
*/
2760
2760
2761
2761
err_free_debugfs :
2762
- if (adapter -> debugfs_root ) {
2762
+ if (! IS_ERR_OR_NULL ( adapter -> debugfs_root ) ) {
2763
2763
cleanup_debugfs (adapter );
2764
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
2829
* Tear down our debugfs entries.
2830
2830
*/
2831
- if (adapter -> debugfs_root ) {
2831
+ if (! IS_ERR_OR_NULL ( adapter -> debugfs_root ) ) {
2832
2832
cleanup_debugfs (adapter );
2833
2833
debugfs_remove_recursive (adapter -> debugfs_root );
2834
2834
}
@@ -2916,12 +2916,12 @@ static int __init cxgb4vf_module_init(void)
2916
2916
2917
2917
/* Debugfs support is optional, just warn if this fails */
2918
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
2920
printk (KERN_WARNING KBUILD_MODNAME ": could not create"
2921
2921
" debugfs entry, continuing\n" );
2922
2922
2923
2923
ret = pci_register_driver (& cxgb4vf_driver );
2924
- if (ret < 0 )
2924
+ if (ret < 0 && ! IS_ERR_OR_NULL ( cxgb4vf_debugfs_root ) )
2925
2925
debugfs_remove (cxgb4vf_debugfs_root );
2926
2926
return ret ;
2927
2927
}
0 commit comments