diff options
author | Zhaolei <zhaolei@cn.fujitsu.com> | 2008-10-22 05:07:25 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2008-10-31 19:00:45 -0400 |
commit | cfa3fa405a5eafd5d5c53b18abc00ca998c35eef (patch) | |
tree | d2be111acfed0d9f563453eb205642d05c964f89 /drivers/net/wireless/rt2x00/rt2x00debug.c | |
parent | 9b24001db145cf1da76a479918373c18aa10bb4b (diff) |
Fix debugfs_create_*'s error checking method for wireless/rt2x00/
debugfs_create_*() returns NULL if an error occurs, returns -ENODEV
when debugfs is not enabled in the kernel.
Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com>
Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/rt2x00/rt2x00debug.c')
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2x00debug.c | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2x00debug.c b/drivers/net/wireless/rt2x00/rt2x00debug.c index 96bc0a0336f0..a31418a700c1 100644 --- a/drivers/net/wireless/rt2x00/rt2x00debug.c +++ b/drivers/net/wireless/rt2x00/rt2x00debug.c | |||
@@ -587,29 +587,29 @@ void rt2x00debug_register(struct rt2x00_dev *rt2x00dev) | |||
587 | intf->driver_folder = | 587 | intf->driver_folder = |
588 | debugfs_create_dir(intf->rt2x00dev->ops->name, | 588 | debugfs_create_dir(intf->rt2x00dev->ops->name, |
589 | rt2x00dev->hw->wiphy->debugfsdir); | 589 | rt2x00dev->hw->wiphy->debugfsdir); |
590 | if (IS_ERR(intf->driver_folder)) | 590 | if (IS_ERR(intf->driver_folder) || !intf->driver_folder) |
591 | goto exit; | 591 | goto exit; |
592 | 592 | ||
593 | intf->driver_entry = | 593 | intf->driver_entry = |
594 | rt2x00debug_create_file_driver("driver", intf, &intf->driver_blob); | 594 | rt2x00debug_create_file_driver("driver", intf, &intf->driver_blob); |
595 | if (IS_ERR(intf->driver_entry)) | 595 | if (IS_ERR(intf->driver_entry) || !intf->driver_entry) |
596 | goto exit; | 596 | goto exit; |
597 | 597 | ||
598 | intf->chipset_entry = | 598 | intf->chipset_entry = |
599 | rt2x00debug_create_file_chipset("chipset", | 599 | rt2x00debug_create_file_chipset("chipset", |
600 | intf, &intf->chipset_blob); | 600 | intf, &intf->chipset_blob); |
601 | if (IS_ERR(intf->chipset_entry)) | 601 | if (IS_ERR(intf->chipset_entry) || !intf->chipset_entry) |
602 | goto exit; | 602 | goto exit; |
603 | 603 | ||
604 | intf->dev_flags = debugfs_create_file("dev_flags", S_IRUSR, | 604 | intf->dev_flags = debugfs_create_file("dev_flags", S_IRUSR, |
605 | intf->driver_folder, intf, | 605 | intf->driver_folder, intf, |
606 | &rt2x00debug_fop_dev_flags); | 606 | &rt2x00debug_fop_dev_flags); |
607 | if (IS_ERR(intf->dev_flags)) | 607 | if (IS_ERR(intf->dev_flags) || !intf->dev_flags) |
608 | goto exit; | 608 | goto exit; |
609 | 609 | ||
610 | intf->register_folder = | 610 | intf->register_folder = |
611 | debugfs_create_dir("register", intf->driver_folder); | 611 | debugfs_create_dir("register", intf->driver_folder); |
612 | if (IS_ERR(intf->register_folder)) | 612 | if (IS_ERR(intf->register_folder) || !intf->register_folder) |
613 | goto exit; | 613 | goto exit; |
614 | 614 | ||
615 | #define RT2X00DEBUGFS_CREATE_REGISTER_ENTRY(__intf, __name) \ | 615 | #define RT2X00DEBUGFS_CREATE_REGISTER_ENTRY(__intf, __name) \ |
@@ -619,7 +619,8 @@ void rt2x00debug_register(struct rt2x00_dev *rt2x00dev) | |||
619 | S_IRUSR | S_IWUSR, \ | 619 | S_IRUSR | S_IWUSR, \ |
620 | (__intf)->register_folder, \ | 620 | (__intf)->register_folder, \ |
621 | &(__intf)->offset_##__name); \ | 621 | &(__intf)->offset_##__name); \ |
622 | if (IS_ERR((__intf)->__name##_off_entry)) \ | 622 | if (IS_ERR((__intf)->__name##_off_entry) \ |
623 | || !(__intf)->__name##_off_entry) \ | ||
623 | goto exit; \ | 624 | goto exit; \ |
624 | \ | 625 | \ |
625 | (__intf)->__name##_val_entry = \ | 626 | (__intf)->__name##_val_entry = \ |
@@ -627,7 +628,8 @@ void rt2x00debug_register(struct rt2x00_dev *rt2x00dev) | |||
627 | S_IRUSR | S_IWUSR, \ | 628 | S_IRUSR | S_IWUSR, \ |
628 | (__intf)->register_folder, \ | 629 | (__intf)->register_folder, \ |
629 | (__intf), &rt2x00debug_fop_##__name);\ | 630 | (__intf), &rt2x00debug_fop_##__name);\ |
630 | if (IS_ERR((__intf)->__name##_val_entry)) \ | 631 | if (IS_ERR((__intf)->__name##_val_entry) \ |
632 | || !(__intf)->__name##_val_entry) \ | ||
631 | goto exit; \ | 633 | goto exit; \ |
632 | }) | 634 | }) |
633 | 635 | ||
@@ -640,13 +642,14 @@ void rt2x00debug_register(struct rt2x00_dev *rt2x00dev) | |||
640 | 642 | ||
641 | intf->queue_folder = | 643 | intf->queue_folder = |
642 | debugfs_create_dir("queue", intf->driver_folder); | 644 | debugfs_create_dir("queue", intf->driver_folder); |
643 | if (IS_ERR(intf->queue_folder)) | 645 | if (IS_ERR(intf->queue_folder) || !intf->queue_folder) |
644 | goto exit; | 646 | goto exit; |
645 | 647 | ||
646 | intf->queue_frame_dump_entry = | 648 | intf->queue_frame_dump_entry = |
647 | debugfs_create_file("dump", S_IRUSR, intf->queue_folder, | 649 | debugfs_create_file("dump", S_IRUSR, intf->queue_folder, |
648 | intf, &rt2x00debug_fop_queue_dump); | 650 | intf, &rt2x00debug_fop_queue_dump); |
649 | if (IS_ERR(intf->queue_frame_dump_entry)) | 651 | if (IS_ERR(intf->queue_frame_dump_entry) |
652 | || !intf->queue_frame_dump_entry) | ||
650 | goto exit; | 653 | goto exit; |
651 | 654 | ||
652 | skb_queue_head_init(&intf->frame_dump_skbqueue); | 655 | skb_queue_head_init(&intf->frame_dump_skbqueue); |