aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorDan Carpenter <error27@gmail.com>2010-04-28 05:01:15 -0400
committerJohn W. Linville <linville@tuxdriver.com>2010-04-28 16:50:28 -0400
commitf7f7cc47fce6f01c3d3374c51508859c328ad5b2 (patch)
treeb51b8d9bafedabc87362ff5767c2e94f9b3ed5a5 /drivers
parentbaff8006b58bb7fca5d1ea1825bc8c6486900303 (diff)
iwl: cleanup: remove unneeded error handling
This is just a cleanup and doesn't change how the code works. debugfs_create_dir() and debugfs_create_file() return an error pointer (-ENODEV) if CONFIG_DEBUG_FS is not enabled, otherwise if an error occurs they return NULL. This is how they are implemented and what it says in the DebugFS documentation. DebugFS can not be compiled as a module. As a result, we only need to check for error pointers and particularly -ENODEV one time to know that DebugFS is enabled. This patch keeps the first check for error pointers and removes the rest. The other reason for this patch, is that it silences some Smatch warnings. Smatch sees the condition "(result != -ENODEV)" and assumes that it's possible for "result" to equal -ENODEV. If it were possible it would lead to an error pointer dereference. But since it's not, we can just remove the check. Signed-off-by: Dan Carpenter <error27@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/wireless/iwmc3200wifi/debugfs.c63
1 files changed, 0 insertions, 63 deletions
diff --git a/drivers/net/wireless/iwmc3200wifi/debugfs.c b/drivers/net/wireless/iwmc3200wifi/debugfs.c
index 48930c1a0f76..c916152bb936 100644
--- a/drivers/net/wireless/iwmc3200wifi/debugfs.c
+++ b/drivers/net/wireless/iwmc3200wifi/debugfs.c
@@ -442,40 +442,10 @@ int iwm_debugfs_init(struct iwm_priv *iwm)
442 snprintf(devdir, sizeof(devdir), "%s", wiphy_name(iwm_to_wiphy(iwm))); 442 snprintf(devdir, sizeof(devdir), "%s", wiphy_name(iwm_to_wiphy(iwm)));
443 443
444 iwm->dbg.devdir = debugfs_create_dir(devdir, iwm->dbg.rootdir); 444 iwm->dbg.devdir = debugfs_create_dir(devdir, iwm->dbg.rootdir);
445 result = PTR_ERR(iwm->dbg.devdir);
446 if (IS_ERR(iwm->dbg.devdir) && (result != -ENODEV)) {
447 IWM_ERR(iwm, "Couldn't create devdir: %d\n", result);
448 goto error;
449 }
450
451 iwm->dbg.dbgdir = debugfs_create_dir("debug", iwm->dbg.devdir); 445 iwm->dbg.dbgdir = debugfs_create_dir("debug", iwm->dbg.devdir);
452 result = PTR_ERR(iwm->dbg.dbgdir);
453 if (IS_ERR(iwm->dbg.dbgdir) && (result != -ENODEV)) {
454 IWM_ERR(iwm, "Couldn't create dbgdir: %d\n", result);
455 goto error;
456 }
457
458 iwm->dbg.rxdir = debugfs_create_dir("rx", iwm->dbg.devdir); 446 iwm->dbg.rxdir = debugfs_create_dir("rx", iwm->dbg.devdir);
459 result = PTR_ERR(iwm->dbg.rxdir);
460 if (IS_ERR(iwm->dbg.rxdir) && (result != -ENODEV)) {
461 IWM_ERR(iwm, "Couldn't create rx dir: %d\n", result);
462 goto error;
463 }
464
465 iwm->dbg.txdir = debugfs_create_dir("tx", iwm->dbg.devdir); 447 iwm->dbg.txdir = debugfs_create_dir("tx", iwm->dbg.devdir);
466 result = PTR_ERR(iwm->dbg.txdir);
467 if (IS_ERR(iwm->dbg.txdir) && (result != -ENODEV)) {
468 IWM_ERR(iwm, "Couldn't create tx dir: %d\n", result);
469 goto error;
470 }
471
472 iwm->dbg.busdir = debugfs_create_dir("bus", iwm->dbg.devdir); 448 iwm->dbg.busdir = debugfs_create_dir("bus", iwm->dbg.devdir);
473 result = PTR_ERR(iwm->dbg.busdir);
474 if (IS_ERR(iwm->dbg.busdir) && (result != -ENODEV)) {
475 IWM_ERR(iwm, "Couldn't create bus dir: %d\n", result);
476 goto error;
477 }
478
479 if (iwm->bus_ops->debugfs_init) { 449 if (iwm->bus_ops->debugfs_init) {
480 result = iwm->bus_ops->debugfs_init(iwm, iwm->dbg.busdir); 450 result = iwm->bus_ops->debugfs_init(iwm, iwm->dbg.busdir);
481 if (result < 0) { 451 if (result < 0) {
@@ -484,27 +454,15 @@ int iwm_debugfs_init(struct iwm_priv *iwm)
484 } 454 }
485 } 455 }
486 456
487
488 iwm->dbg.dbg_level = IWM_DL_NONE; 457 iwm->dbg.dbg_level = IWM_DL_NONE;
489 iwm->dbg.dbg_level_dentry = 458 iwm->dbg.dbg_level_dentry =
490 debugfs_create_file("level", 0200, iwm->dbg.dbgdir, iwm, 459 debugfs_create_file("level", 0200, iwm->dbg.dbgdir, iwm,
491 &fops_iwm_dbg_level); 460 &fops_iwm_dbg_level);
492 result = PTR_ERR(iwm->dbg.dbg_level_dentry);
493 if (IS_ERR(iwm->dbg.dbg_level_dentry) && (result != -ENODEV)) {
494 IWM_ERR(iwm, "Couldn't create dbg_level: %d\n", result);
495 goto error;
496 }
497
498 461
499 iwm->dbg.dbg_modules = IWM_DM_DEFAULT; 462 iwm->dbg.dbg_modules = IWM_DM_DEFAULT;
500 iwm->dbg.dbg_modules_dentry = 463 iwm->dbg.dbg_modules_dentry =
501 debugfs_create_file("modules", 0200, iwm->dbg.dbgdir, iwm, 464 debugfs_create_file("modules", 0200, iwm->dbg.dbgdir, iwm,
502 &fops_iwm_dbg_modules); 465 &fops_iwm_dbg_modules);
503 result = PTR_ERR(iwm->dbg.dbg_modules_dentry);
504 if (IS_ERR(iwm->dbg.dbg_modules_dentry) && (result != -ENODEV)) {
505 IWM_ERR(iwm, "Couldn't create dbg_modules: %d\n", result);
506 goto error;
507 }
508 466
509 for (i = 0; i < __IWM_DM_NR; i++) 467 for (i = 0; i < __IWM_DM_NR; i++)
510 add_dbg_module(iwm->dbg, iwm_debug_module[i].name, 468 add_dbg_module(iwm->dbg, iwm_debug_module[i].name,
@@ -513,39 +471,18 @@ int iwm_debugfs_init(struct iwm_priv *iwm)
513 iwm->dbg.txq_dentry = debugfs_create_file("queues", 0200, 471 iwm->dbg.txq_dentry = debugfs_create_file("queues", 0200,
514 iwm->dbg.txdir, iwm, 472 iwm->dbg.txdir, iwm,
515 &iwm_debugfs_txq_fops); 473 &iwm_debugfs_txq_fops);
516 result = PTR_ERR(iwm->dbg.txq_dentry);
517 if (IS_ERR(iwm->dbg.txq_dentry) && (result != -ENODEV)) {
518 IWM_ERR(iwm, "Couldn't create tx queue: %d\n", result);
519 goto error;
520 }
521 474
522 iwm->dbg.tx_credit_dentry = debugfs_create_file("credits", 0200, 475 iwm->dbg.tx_credit_dentry = debugfs_create_file("credits", 0200,
523 iwm->dbg.txdir, iwm, 476 iwm->dbg.txdir, iwm,
524 &iwm_debugfs_tx_credit_fops); 477 &iwm_debugfs_tx_credit_fops);
525 result = PTR_ERR(iwm->dbg.tx_credit_dentry);
526 if (IS_ERR(iwm->dbg.tx_credit_dentry) && (result != -ENODEV)) {
527 IWM_ERR(iwm, "Couldn't create tx credit: %d\n", result);
528 goto error;
529 }
530 478
531 iwm->dbg.rx_ticket_dentry = debugfs_create_file("tickets", 0200, 479 iwm->dbg.rx_ticket_dentry = debugfs_create_file("tickets", 0200,
532 iwm->dbg.rxdir, iwm, 480 iwm->dbg.rxdir, iwm,
533 &iwm_debugfs_rx_ticket_fops); 481 &iwm_debugfs_rx_ticket_fops);
534 result = PTR_ERR(iwm->dbg.rx_ticket_dentry);
535 if (IS_ERR(iwm->dbg.rx_ticket_dentry) && (result != -ENODEV)) {
536 IWM_ERR(iwm, "Couldn't create rx ticket: %d\n", result);
537 goto error;
538 }
539 482
540 iwm->dbg.fw_err_dentry = debugfs_create_file("last_fw_err", 0200, 483 iwm->dbg.fw_err_dentry = debugfs_create_file("last_fw_err", 0200,
541 iwm->dbg.dbgdir, iwm, 484 iwm->dbg.dbgdir, iwm,
542 &iwm_debugfs_fw_err_fops); 485 &iwm_debugfs_fw_err_fops);
543 result = PTR_ERR(iwm->dbg.fw_err_dentry);
544 if (IS_ERR(iwm->dbg.fw_err_dentry) && (result != -ENODEV)) {
545 IWM_ERR(iwm, "Couldn't create last FW err: %d\n", result);
546 goto error;
547 }
548
549 486
550 return 0; 487 return 0;
551 488