aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/wl12xx/debugfs.c
diff options
context:
space:
mode:
authorEliad Peller <eliad@wizery.com>2010-12-15 04:47:54 -0500
committerLuciano Coelho <coelho@ti.com>2011-01-24 15:11:45 -0500
commit3c2c04a15f5fe5d169fe343c9eb7c1856d3033d3 (patch)
tree26ad5b833ff5c528852f21ac7108b33aac73a055 /drivers/net/wireless/wl12xx/debugfs.c
parent4a4fdf2e0b9e3534f6ec4f3e7077470bd66924ab (diff)
wl12xx: remove redundant debugfs_remove_recursive() call
Upon rmmod, the <debugfs>/ieee80211/phyX dir is being removed. later, we try to remove <debugfs>/ieee80211/phyX/wl12xx, which might result in NULL dereference. Remove the excessive debugfs_remove_recursive() call. (consequently, there is no more need to save wl->rootdir) Reported-by: Arik Nemtsov <arik@wizery.com> Signed-off-by: Eliad Peller <eliad@wizery.com> Signed-off-by: Luciano Coelho <luciano.coelho@nokia.com>
Diffstat (limited to 'drivers/net/wireless/wl12xx/debugfs.c')
-rw-r--r--drivers/net/wireless/wl12xx/debugfs.c36
1 files changed, 16 insertions, 20 deletions
diff --git a/drivers/net/wireless/wl12xx/debugfs.c b/drivers/net/wireless/wl12xx/debugfs.c
index ec6077760157..36e7ec1e0c3b 100644
--- a/drivers/net/wireless/wl12xx/debugfs.c
+++ b/drivers/net/wireless/wl12xx/debugfs.c
@@ -293,12 +293,13 @@ static const struct file_operations gpio_power_ops = {
293 .llseek = default_llseek, 293 .llseek = default_llseek,
294}; 294};
295 295
296static int wl1271_debugfs_add_files(struct wl1271 *wl) 296static int wl1271_debugfs_add_files(struct wl1271 *wl,
297 struct dentry *rootdir)
297{ 298{
298 int ret = 0; 299 int ret = 0;
299 struct dentry *entry, *stats; 300 struct dentry *entry, *stats;
300 301
301 stats = debugfs_create_dir("fw-statistics", wl->rootdir); 302 stats = debugfs_create_dir("fw-statistics", rootdir);
302 if (!stats || IS_ERR(stats)) { 303 if (!stats || IS_ERR(stats)) {
303 entry = stats; 304 entry = stats;
304 goto err; 305 goto err;
@@ -395,13 +396,13 @@ static int wl1271_debugfs_add_files(struct wl1271 *wl)
395 DEBUGFS_FWSTATS_ADD(rxpipe, missed_beacon_host_int_trig_rx_data); 396 DEBUGFS_FWSTATS_ADD(rxpipe, missed_beacon_host_int_trig_rx_data);
396 DEBUGFS_FWSTATS_ADD(rxpipe, tx_xfr_host_int_trig_rx_data); 397 DEBUGFS_FWSTATS_ADD(rxpipe, tx_xfr_host_int_trig_rx_data);
397 398
398 DEBUGFS_ADD(tx_queue_len, wl->rootdir); 399 DEBUGFS_ADD(tx_queue_len, rootdir);
399 DEBUGFS_ADD(retry_count, wl->rootdir); 400 DEBUGFS_ADD(retry_count, rootdir);
400 DEBUGFS_ADD(excessive_retries, wl->rootdir); 401 DEBUGFS_ADD(excessive_retries, rootdir);
401 402
402 DEBUGFS_ADD(gpio_power, wl->rootdir); 403 DEBUGFS_ADD(gpio_power, rootdir);
403 404
404 entry = debugfs_create_x32("debug_level", 0600, wl->rootdir, 405 entry = debugfs_create_x32("debug_level", 0600, rootdir,
405 &wl12xx_debug_level); 406 &wl12xx_debug_level);
406 if (!entry || IS_ERR(entry)) 407 if (!entry || IS_ERR(entry))
407 goto err; 408 goto err;
@@ -419,7 +420,7 @@ err:
419 420
420void wl1271_debugfs_reset(struct wl1271 *wl) 421void wl1271_debugfs_reset(struct wl1271 *wl)
421{ 422{
422 if (!wl->rootdir) 423 if (!wl->stats.fw_stats)
423 return; 424 return;
424 425
425 memset(wl->stats.fw_stats, 0, sizeof(*wl->stats.fw_stats)); 426 memset(wl->stats.fw_stats, 0, sizeof(*wl->stats.fw_stats));
@@ -430,13 +431,13 @@ void wl1271_debugfs_reset(struct wl1271 *wl)
430int wl1271_debugfs_init(struct wl1271 *wl) 431int wl1271_debugfs_init(struct wl1271 *wl)
431{ 432{
432 int ret; 433 int ret;
434 struct dentry *rootdir;
433 435
434 wl->rootdir = debugfs_create_dir(KBUILD_MODNAME, 436 rootdir = debugfs_create_dir(KBUILD_MODNAME,
435 wl->hw->wiphy->debugfsdir); 437 wl->hw->wiphy->debugfsdir);
436 438
437 if (IS_ERR(wl->rootdir)) { 439 if (IS_ERR(rootdir)) {
438 ret = PTR_ERR(wl->rootdir); 440 ret = PTR_ERR(rootdir);
439 wl->rootdir = NULL;
440 goto err; 441 goto err;
441 } 442 }
442 443
@@ -450,7 +451,7 @@ int wl1271_debugfs_init(struct wl1271 *wl)
450 451
451 wl->stats.fw_stats_update = jiffies; 452 wl->stats.fw_stats_update = jiffies;
452 453
453 ret = wl1271_debugfs_add_files(wl); 454 ret = wl1271_debugfs_add_files(wl, rootdir);
454 455
455 if (ret < 0) 456 if (ret < 0)
456 goto err_file; 457 goto err_file;
@@ -462,8 +463,7 @@ err_file:
462 wl->stats.fw_stats = NULL; 463 wl->stats.fw_stats = NULL;
463 464
464err_fw: 465err_fw:
465 debugfs_remove_recursive(wl->rootdir); 466 debugfs_remove_recursive(rootdir);
466 wl->rootdir = NULL;
467 467
468err: 468err:
469 return ret; 469 return ret;
@@ -473,8 +473,4 @@ void wl1271_debugfs_exit(struct wl1271 *wl)
473{ 473{
474 kfree(wl->stats.fw_stats); 474 kfree(wl->stats.fw_stats);
475 wl->stats.fw_stats = NULL; 475 wl->stats.fw_stats = NULL;
476
477 debugfs_remove_recursive(wl->rootdir);
478 wl->rootdir = NULL;
479
480} 476}