.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
---|
1 | 2 | /* |
---|
2 | 3 | |
---|
3 | 4 | Broadcom B43 wireless driver |
---|
.. | .. |
---|
6 | 7 | |
---|
7 | 8 | Copyright (c) 2005-2007 Michael Buesch <m@bues.ch> |
---|
8 | 9 | |
---|
9 | | - This program is free software; you can redistribute it and/or modify |
---|
10 | | - it under the terms of the GNU General Public License as published by |
---|
11 | | - the Free Software Foundation; either version 2 of the License, or |
---|
12 | | - (at your option) any later version. |
---|
13 | | - |
---|
14 | | - This program is distributed in the hope that it will be useful, |
---|
15 | | - but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
16 | | - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
17 | | - GNU General Public License for more details. |
---|
18 | | - |
---|
19 | | - You should have received a copy of the GNU General Public License |
---|
20 | | - along with this program; see the file COPYING. If not, write to |
---|
21 | | - the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor, |
---|
22 | | - Boston, MA 02110-1301, USA. |
---|
23 | 10 | |
---|
24 | 11 | */ |
---|
25 | 12 | |
---|
.. | .. |
---|
64 | 51 | #define fappend(fmt, x...) \ |
---|
65 | 52 | do { \ |
---|
66 | 53 | if (bufsize - count) \ |
---|
67 | | - count += snprintf(buf + count, \ |
---|
| 54 | + count += scnprintf(buf + count, \ |
---|
68 | 55 | bufsize - count, \ |
---|
69 | 56 | fmt , ##x); \ |
---|
70 | 57 | else \ |
---|
.. | .. |
---|
506 | 493 | struct b43_wldev *dev; |
---|
507 | 494 | struct b43_debugfs_fops *dfops; |
---|
508 | 495 | struct b43_dfs_file *dfile; |
---|
509 | | - ssize_t uninitialized_var(ret); |
---|
| 496 | + ssize_t ret; |
---|
510 | 497 | char *buf; |
---|
511 | 498 | const size_t bufsize = 1024 * 16; /* 16 kiB buffer */ |
---|
512 | 499 | const size_t buforder = get_order(bufsize); |
---|
.. | .. |
---|
668 | 655 | static void b43_add_dynamic_debug(struct b43_wldev *dev) |
---|
669 | 656 | { |
---|
670 | 657 | struct b43_dfsentry *e = dev->dfsentry; |
---|
671 | | - struct dentry *d; |
---|
672 | 658 | |
---|
673 | | -#define add_dyn_dbg(name, id, initstate) do { \ |
---|
674 | | - e->dyn_debug[id] = (initstate); \ |
---|
675 | | - d = debugfs_create_bool(name, 0600, e->subdir, \ |
---|
676 | | - &(e->dyn_debug[id])); \ |
---|
677 | | - if (!IS_ERR(d)) \ |
---|
678 | | - e->dyn_debug_dentries[id] = d; \ |
---|
679 | | - } while (0) |
---|
| 659 | +#define add_dyn_dbg(name, id, initstate) do { \ |
---|
| 660 | + e->dyn_debug[id] = (initstate); \ |
---|
| 661 | + e->dyn_debug_dentries[id] = \ |
---|
| 662 | + debugfs_create_bool(name, 0600, e->subdir, \ |
---|
| 663 | + &(e->dyn_debug[id])); \ |
---|
| 664 | + } while (0) |
---|
680 | 665 | |
---|
681 | 666 | add_dyn_dbg("debug_xmitpower", B43_DBG_XMITPOWER, false); |
---|
682 | 667 | add_dyn_dbg("debug_dmaoverflow", B43_DBG_DMAOVERFLOW, false); |
---|
.. | .. |
---|
718 | 703 | |
---|
719 | 704 | snprintf(devdir, sizeof(devdir), "%s", wiphy_name(dev->wl->hw->wiphy)); |
---|
720 | 705 | e->subdir = debugfs_create_dir(devdir, rootdir); |
---|
721 | | - if (!e->subdir || IS_ERR(e->subdir)) { |
---|
722 | | - if (e->subdir == ERR_PTR(-ENODEV)) { |
---|
723 | | - b43dbg(dev->wl, "DebugFS (CONFIG_DEBUG_FS) not " |
---|
724 | | - "enabled in kernel config\n"); |
---|
725 | | - } else { |
---|
726 | | - b43err(dev->wl, "debugfs: cannot create %s directory\n", |
---|
727 | | - devdir); |
---|
728 | | - } |
---|
729 | | - dev->dfsentry = NULL; |
---|
730 | | - kfree(log->log); |
---|
731 | | - kfree(e); |
---|
732 | | - return; |
---|
733 | | - } |
---|
734 | 706 | |
---|
735 | 707 | e->mmio16read_next = 0xFFFF; /* invalid address */ |
---|
736 | 708 | e->mmio32read_next = 0xFFFF; /* invalid address */ |
---|
.. | .. |
---|
741 | 713 | |
---|
742 | 714 | #define ADD_FILE(name, mode) \ |
---|
743 | 715 | do { \ |
---|
744 | | - struct dentry *d; \ |
---|
745 | | - d = debugfs_create_file(__stringify(name), \ |
---|
| 716 | + e->file_##name.dentry = \ |
---|
| 717 | + debugfs_create_file(__stringify(name), \ |
---|
746 | 718 | mode, e->subdir, dev, \ |
---|
747 | 719 | &fops_##name.fops); \ |
---|
748 | | - e->file_##name.dentry = NULL; \ |
---|
749 | | - if (!IS_ERR(d)) \ |
---|
750 | | - e->file_##name.dentry = d; \ |
---|
751 | 720 | } while (0) |
---|
752 | 721 | |
---|
753 | 722 | |
---|
.. | .. |
---|
818 | 787 | void b43_debugfs_init(void) |
---|
819 | 788 | { |
---|
820 | 789 | rootdir = debugfs_create_dir(KBUILD_MODNAME, NULL); |
---|
821 | | - if (IS_ERR(rootdir)) |
---|
822 | | - rootdir = NULL; |
---|
823 | 790 | } |
---|
824 | 791 | |
---|
825 | 792 | void b43_debugfs_exit(void) |
---|