| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | |
|---|
| 3 | 4 | Broadcom B43legacy 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 | |
|---|
| .. | .. |
|---|
| 67 | 54 | #define fappend(fmt, x...) \ |
|---|
| 68 | 55 | do { \ |
|---|
| 69 | 56 | if (bufsize - count) \ |
|---|
| 70 | | - count += snprintf(buf + count, \ |
|---|
| 57 | + count += scnprintf(buf + count, \ |
|---|
| 71 | 58 | bufsize - count, \ |
|---|
| 72 | 59 | fmt , ##x); \ |
|---|
| 73 | 60 | else \ |
|---|
| .. | .. |
|---|
| 203 | 190 | struct b43legacy_wldev *dev; |
|---|
| 204 | 191 | struct b43legacy_debugfs_fops *dfops; |
|---|
| 205 | 192 | struct b43legacy_dfs_file *dfile; |
|---|
| 206 | | - ssize_t uninitialized_var(ret); |
|---|
| 193 | + ssize_t ret; |
|---|
| 207 | 194 | char *buf; |
|---|
| 208 | 195 | const size_t bufsize = 1024 * 16; /* 16 KiB buffer */ |
|---|
| 209 | 196 | const size_t buforder = get_order(bufsize); |
|---|
| .. | .. |
|---|
| 361 | 348 | static void b43legacy_add_dynamic_debug(struct b43legacy_wldev *dev) |
|---|
| 362 | 349 | { |
|---|
| 363 | 350 | struct b43legacy_dfsentry *e = dev->dfsentry; |
|---|
| 364 | | - struct dentry *d; |
|---|
| 365 | 351 | |
|---|
| 366 | | -#define add_dyn_dbg(name, id, initstate) do { \ |
|---|
| 367 | | - e->dyn_debug[id] = (initstate); \ |
|---|
| 368 | | - d = debugfs_create_bool(name, 0600, e->subdir, \ |
|---|
| 369 | | - &(e->dyn_debug[id])); \ |
|---|
| 370 | | - if (!IS_ERR(d)) \ |
|---|
| 371 | | - e->dyn_debug_dentries[id] = d; \ |
|---|
| 372 | | - } while (0) |
|---|
| 352 | +#define add_dyn_dbg(name, id, initstate) do { \ |
|---|
| 353 | + e->dyn_debug[id] = (initstate); \ |
|---|
| 354 | + e->dyn_debug_dentries[id] = \ |
|---|
| 355 | + debugfs_create_bool(name, 0600, e->subdir, \ |
|---|
| 356 | + &(e->dyn_debug[id])); \ |
|---|
| 357 | + } while (0) |
|---|
| 373 | 358 | |
|---|
| 374 | 359 | add_dyn_dbg("debug_xmitpower", B43legacy_DBG_XMITPOWER, false); |
|---|
| 375 | 360 | add_dyn_dbg("debug_dmaoverflow", B43legacy_DBG_DMAOVERFLOW, false); |
|---|
| .. | .. |
|---|
| 408 | 393 | |
|---|
| 409 | 394 | snprintf(devdir, sizeof(devdir), "%s", wiphy_name(dev->wl->hw->wiphy)); |
|---|
| 410 | 395 | e->subdir = debugfs_create_dir(devdir, rootdir); |
|---|
| 411 | | - if (!e->subdir || IS_ERR(e->subdir)) { |
|---|
| 412 | | - if (e->subdir == ERR_PTR(-ENODEV)) { |
|---|
| 413 | | - b43legacydbg(dev->wl, "DebugFS (CONFIG_DEBUG_FS) not " |
|---|
| 414 | | - "enabled in kernel config\n"); |
|---|
| 415 | | - } else { |
|---|
| 416 | | - b43legacyerr(dev->wl, "debugfs: cannot create %s directory\n", |
|---|
| 417 | | - devdir); |
|---|
| 418 | | - } |
|---|
| 419 | | - dev->dfsentry = NULL; |
|---|
| 420 | | - kfree(log->log); |
|---|
| 421 | | - kfree(e); |
|---|
| 422 | | - return; |
|---|
| 423 | | - } |
|---|
| 424 | 396 | |
|---|
| 425 | 397 | #define ADD_FILE(name, mode) \ |
|---|
| 426 | 398 | do { \ |
|---|
| 427 | | - struct dentry *d; \ |
|---|
| 428 | | - d = debugfs_create_file(__stringify(name), \ |
|---|
| 399 | + e->file_##name.dentry = \ |
|---|
| 400 | + debugfs_create_file(__stringify(name), \ |
|---|
| 429 | 401 | mode, e->subdir, dev, \ |
|---|
| 430 | 402 | &fops_##name.fops); \ |
|---|
| 431 | 403 | e->file_##name.dentry = NULL; \ |
|---|
| 432 | | - if (!IS_ERR(d)) \ |
|---|
| 433 | | - e->file_##name.dentry = d; \ |
|---|
| 434 | 404 | } while (0) |
|---|
| 435 | 405 | |
|---|
| 436 | 406 | |
|---|
| .. | .. |
|---|
| 492 | 462 | void b43legacy_debugfs_init(void) |
|---|
| 493 | 463 | { |
|---|
| 494 | 464 | rootdir = debugfs_create_dir(KBUILD_MODNAME, NULL); |
|---|
| 495 | | - if (IS_ERR(rootdir)) |
|---|
| 496 | | - rootdir = NULL; |
|---|
| 497 | 465 | } |
|---|
| 498 | 466 | |
|---|
| 499 | 467 | void b43legacy_debugfs_exit(void) |
|---|