forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-05-13 9d77db3c730780c8ef5ccd4b66403ff5675cfe4e
kernel/drivers/net/wireless/ti/wl1251/debugfs.c
....@@ -1,22 +1,8 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * This file is part of wl1251
34 *
45 * Copyright (C) 2009 Nokia Corporation
5
- *
6
- * This program is free software; you can redistribute it and/or
7
- * modify it under the terms of the GNU General Public License
8
- * version 2 as published by the Free Software Foundation.
9
- *
10
- * This program is distributed in the hope that it will be useful, but
11
- * WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
- * General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License
16
- * along with this program; if not, write to the Free Software
17
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
18
- * 02110-1301 USA
19
- *
206 */
217
228 #include "debugfs.h"
....@@ -54,11 +40,6 @@
5440 #define DEBUGFS_ADD(name, parent) \
5541 wl->debugfs.name = debugfs_create_file(#name, 0400, parent, \
5642 wl, &name## _ops); \
57
- if (IS_ERR(wl->debugfs.name)) { \
58
- ret = PTR_ERR(wl->debugfs.name); \
59
- wl->debugfs.name = NULL; \
60
- goto out; \
61
- }
6243
6344 #define DEBUGFS_DEL(name) \
6445 do { \
....@@ -354,10 +335,8 @@
354335 DEBUGFS_DEL(excessive_retries);
355336 }
356337
357
-static int wl1251_debugfs_add_files(struct wl1251 *wl)
338
+static void wl1251_debugfs_add_files(struct wl1251 *wl)
358339 {
359
- int ret = 0;
360
-
361340 DEBUGFS_FWSTATS_ADD(tx, internal_desc_overflow);
362341
363342 DEBUGFS_FWSTATS_ADD(rx, out_of_mem);
....@@ -453,12 +432,6 @@
453432 DEBUGFS_ADD(tx_queue_status, wl->debugfs.rootdir);
454433 DEBUGFS_ADD(retry_count, wl->debugfs.rootdir);
455434 DEBUGFS_ADD(excessive_retries, wl->debugfs.rootdir);
456
-
457
-out:
458
- if (ret < 0)
459
- wl1251_debugfs_delete_files(wl);
460
-
461
- return ret;
462435 }
463436
464437 void wl1251_debugfs_reset(struct wl1251 *wl)
....@@ -471,56 +444,20 @@
471444
472445 int wl1251_debugfs_init(struct wl1251 *wl)
473446 {
474
- int ret;
447
+ wl->stats.fw_stats = kzalloc(sizeof(*wl->stats.fw_stats), GFP_KERNEL);
448
+ if (!wl->stats.fw_stats)
449
+ return -ENOMEM;
475450
476451 wl->debugfs.rootdir = debugfs_create_dir(KBUILD_MODNAME, NULL);
477
-
478
- if (IS_ERR(wl->debugfs.rootdir)) {
479
- ret = PTR_ERR(wl->debugfs.rootdir);
480
- wl->debugfs.rootdir = NULL;
481
- goto err;
482
- }
483452
484453 wl->debugfs.fw_statistics = debugfs_create_dir("fw-statistics",
485454 wl->debugfs.rootdir);
486455
487
- if (IS_ERR(wl->debugfs.fw_statistics)) {
488
- ret = PTR_ERR(wl->debugfs.fw_statistics);
489
- wl->debugfs.fw_statistics = NULL;
490
- goto err_root;
491
- }
492
-
493
- wl->stats.fw_stats = kzalloc(sizeof(*wl->stats.fw_stats),
494
- GFP_KERNEL);
495
-
496
- if (!wl->stats.fw_stats) {
497
- ret = -ENOMEM;
498
- goto err_fw;
499
- }
500
-
501456 wl->stats.fw_stats_update = jiffies;
502457
503
- ret = wl1251_debugfs_add_files(wl);
504
-
505
- if (ret < 0)
506
- goto err_file;
458
+ wl1251_debugfs_add_files(wl);
507459
508460 return 0;
509
-
510
-err_file:
511
- kfree(wl->stats.fw_stats);
512
- wl->stats.fw_stats = NULL;
513
-
514
-err_fw:
515
- debugfs_remove(wl->debugfs.fw_statistics);
516
- wl->debugfs.fw_statistics = NULL;
517
-
518
-err_root:
519
- debugfs_remove(wl->debugfs.rootdir);
520
- wl->debugfs.rootdir = NULL;
521
-
522
-err:
523
- return ret;
524461 }
525462
526463 void wl1251_debugfs_exit(struct wl1251 *wl)