ath10k: fix debugfs_create_dir() checking
authorMichal Kazior <michal.kazior@tieto.com>
Thu, 4 Sep 2014 10:36:45 +0000 (12:36 +0200)
committerKalle Valo <kvalo@qca.qualcomm.com>
Thu, 11 Sep 2014 20:44:44 +0000 (23:44 +0300)
The function may return an -ENODEV if debugfs is
disabled in kernel. This should originally be
guarded by ath10k's Kconfig but it still makes
sense to check for the non-NULL errno return
value.

Reported-by: Matteo Croce <matteo@openwrt.org>
Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
drivers/net/wireless/ath/ath10k/debug.c

index c5d01058c2a3efcbadae155461a62da725dd9c1a..c1921143a87077332edbf9019a4be36b294fbf31 100644 (file)
@@ -1176,8 +1176,12 @@ int ath10k_debug_register(struct ath10k *ar)
 {
        ar->debug.debugfs_phy = debugfs_create_dir("ath10k",
                                                   ar->hw->wiphy->debugfsdir);
-       if (!ar->debug.debugfs_phy)
-               return -ENOMEM;
+       if (IS_ERR_OR_NULL(ar->debug.debugfs_phy)) {
+               if (IS_ERR(ar->debug.debugfs_phy))
+                       return PTR_ERR(ar->debug.debugfs_phy);
+               else
+                       return -ENOMEM;
+       }
 
        INIT_DELAYED_WORK(&ar->debug.htt_stats_dwork,
                          ath10k_debug_htt_stats_dwork);