hc
2024-05-16 8d2a02b24d66aa359e83eebc1ed3c0f85367a1cb
kernel/drivers/net/wireless/broadcom/b43legacy/debugfs.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23
34 Broadcom B43legacy wireless driver
....@@ -6,20 +7,6 @@
67
78 Copyright (c) 2005-2007 Michael Buesch <m@bues.ch>
89
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.
2310
2411 */
2512
....@@ -67,7 +54,7 @@
6754 #define fappend(fmt, x...) \
6855 do { \
6956 if (bufsize - count) \
70
- count += snprintf(buf + count, \
57
+ count += scnprintf(buf + count, \
7158 bufsize - count, \
7259 fmt , ##x); \
7360 else \
....@@ -203,7 +190,7 @@
203190 struct b43legacy_wldev *dev;
204191 struct b43legacy_debugfs_fops *dfops;
205192 struct b43legacy_dfs_file *dfile;
206
- ssize_t uninitialized_var(ret);
193
+ ssize_t ret;
207194 char *buf;
208195 const size_t bufsize = 1024 * 16; /* 16 KiB buffer */
209196 const size_t buforder = get_order(bufsize);
....@@ -361,15 +348,13 @@
361348 static void b43legacy_add_dynamic_debug(struct b43legacy_wldev *dev)
362349 {
363350 struct b43legacy_dfsentry *e = dev->dfsentry;
364
- struct dentry *d;
365351
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)
373358
374359 add_dyn_dbg("debug_xmitpower", B43legacy_DBG_XMITPOWER, false);
375360 add_dyn_dbg("debug_dmaoverflow", B43legacy_DBG_DMAOVERFLOW, false);
....@@ -408,29 +393,14 @@
408393
409394 snprintf(devdir, sizeof(devdir), "%s", wiphy_name(dev->wl->hw->wiphy));
410395 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
- }
424396
425397 #define ADD_FILE(name, mode) \
426398 do { \
427
- struct dentry *d; \
428
- d = debugfs_create_file(__stringify(name), \
399
+ e->file_##name.dentry = \
400
+ debugfs_create_file(__stringify(name), \
429401 mode, e->subdir, dev, \
430402 &fops_##name.fops); \
431403 e->file_##name.dentry = NULL; \
432
- if (!IS_ERR(d)) \
433
- e->file_##name.dentry = d; \
434404 } while (0)
435405
436406
....@@ -492,8 +462,6 @@
492462 void b43legacy_debugfs_init(void)
493463 {
494464 rootdir = debugfs_create_dir(KBUILD_MODNAME, NULL);
495
- if (IS_ERR(rootdir))
496
- rootdir = NULL;
497465 }
498466
499467 void b43legacy_debugfs_exit(void)