hc
2024-02-20 102a0743326a03cd1a1202ceda21e175b7d3575c
kernel/drivers/mtd/ubi/debug.c
....@@ -1,19 +1,6 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * Copyright (c) International Business Machines Corp., 2006
3
- *
4
- * This program is free software; you can redistribute it and/or modify
5
- * it under the terms of the GNU General Public License as published by
6
- * the Free Software Foundation; either version 2 of the License, or
7
- * (at your option) any later version.
8
- *
9
- * This program is distributed in the hope that it will be useful,
10
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
12
- * the GNU General Public License for more details.
13
- *
14
- * You should have received a copy of the GNU General Public License
15
- * along with this program; if not, write to the Free Software
16
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
174 *
185 * Author: Artem Bityutskiy (Битюцкий Артём)
196 */
....@@ -120,6 +107,7 @@
120107 pr_err("\tlast_eb_bytes %d\n", vol->last_eb_bytes);
121108 pr_err("\tcorrupted %d\n", vol->corrupted);
122109 pr_err("\tupd_marker %d\n", vol->upd_marker);
110
+ pr_err("\tskip_check %d\n", vol->skip_check);
123111
124112 if (vol->name_len <= UBI_VOL_NAME_MAX &&
125113 strnlen(vol->name, vol->name_len + 1) == vol->name_len) {
....@@ -514,11 +502,9 @@
514502 */
515503 int ubi_debugfs_init_dev(struct ubi_device *ubi)
516504 {
517
- int err, n;
518505 unsigned long ubi_num = ubi->ubi_num;
519
- const char *fname;
520
- struct dentry *dent;
521506 struct ubi_debug_info *d = &ubi->dbg;
507
+ int n;
522508
523509 if (!IS_ENABLED(CONFIG_DEBUG_FS))
524510 return 0;
....@@ -527,95 +513,52 @@
527513 ubi->ubi_num);
528514 if (n == UBI_DFS_DIR_LEN) {
529515 /* The array size is too small */
530
- fname = UBI_DFS_DIR_NAME;
531
- dent = ERR_PTR(-EINVAL);
532
- goto out;
516
+ return -EINVAL;
533517 }
534518
535
- fname = d->dfs_dir_name;
536
- dent = debugfs_create_dir(fname, dfs_rootdir);
537
- if (IS_ERR_OR_NULL(dent))
538
- goto out;
539
- d->dfs_dir = dent;
519
+ d->dfs_dir = debugfs_create_dir(d->dfs_dir_name, dfs_rootdir);
540520
541
- fname = "chk_gen";
542
- dent = debugfs_create_file(fname, S_IWUSR, d->dfs_dir, (void *)ubi_num,
543
- &dfs_fops);
544
- if (IS_ERR_OR_NULL(dent))
545
- goto out_remove;
546
- d->dfs_chk_gen = dent;
521
+ d->dfs_chk_gen = debugfs_create_file("chk_gen", S_IWUSR, d->dfs_dir,
522
+ (void *)ubi_num, &dfs_fops);
547523
548
- fname = "chk_io";
549
- dent = debugfs_create_file(fname, S_IWUSR, d->dfs_dir, (void *)ubi_num,
550
- &dfs_fops);
551
- if (IS_ERR_OR_NULL(dent))
552
- goto out_remove;
553
- d->dfs_chk_io = dent;
524
+ d->dfs_chk_io = debugfs_create_file("chk_io", S_IWUSR, d->dfs_dir,
525
+ (void *)ubi_num, &dfs_fops);
554526
555
- fname = "chk_fastmap";
556
- dent = debugfs_create_file(fname, S_IWUSR, d->dfs_dir, (void *)ubi_num,
557
- &dfs_fops);
558
- if (IS_ERR_OR_NULL(dent))
559
- goto out_remove;
560
- d->dfs_chk_fastmap = dent;
527
+ d->dfs_chk_fastmap = debugfs_create_file("chk_fastmap", S_IWUSR,
528
+ d->dfs_dir, (void *)ubi_num,
529
+ &dfs_fops);
561530
562
- fname = "tst_disable_bgt";
563
- dent = debugfs_create_file(fname, S_IWUSR, d->dfs_dir, (void *)ubi_num,
564
- &dfs_fops);
565
- if (IS_ERR_OR_NULL(dent))
566
- goto out_remove;
567
- d->dfs_disable_bgt = dent;
531
+ d->dfs_disable_bgt = debugfs_create_file("tst_disable_bgt", S_IWUSR,
532
+ d->dfs_dir, (void *)ubi_num,
533
+ &dfs_fops);
568534
569
- fname = "tst_emulate_bitflips";
570
- dent = debugfs_create_file(fname, S_IWUSR, d->dfs_dir, (void *)ubi_num,
571
- &dfs_fops);
572
- if (IS_ERR_OR_NULL(dent))
573
- goto out_remove;
574
- d->dfs_emulate_bitflips = dent;
535
+ d->dfs_emulate_bitflips = debugfs_create_file("tst_emulate_bitflips",
536
+ S_IWUSR, d->dfs_dir,
537
+ (void *)ubi_num,
538
+ &dfs_fops);
575539
576
- fname = "tst_emulate_io_failures";
577
- dent = debugfs_create_file(fname, S_IWUSR, d->dfs_dir, (void *)ubi_num,
578
- &dfs_fops);
579
- if (IS_ERR_OR_NULL(dent))
580
- goto out_remove;
581
- d->dfs_emulate_io_failures = dent;
540
+ d->dfs_emulate_io_failures = debugfs_create_file("tst_emulate_io_failures",
541
+ S_IWUSR, d->dfs_dir,
542
+ (void *)ubi_num,
543
+ &dfs_fops);
582544
583
- fname = "tst_emulate_power_cut";
584
- dent = debugfs_create_file(fname, S_IWUSR, d->dfs_dir, (void *)ubi_num,
585
- &dfs_fops);
586
- if (IS_ERR_OR_NULL(dent))
587
- goto out_remove;
588
- d->dfs_emulate_power_cut = dent;
545
+ d->dfs_emulate_power_cut = debugfs_create_file("tst_emulate_power_cut",
546
+ S_IWUSR, d->dfs_dir,
547
+ (void *)ubi_num,
548
+ &dfs_fops);
589549
590
- fname = "tst_emulate_power_cut_min";
591
- dent = debugfs_create_file(fname, S_IWUSR, d->dfs_dir, (void *)ubi_num,
592
- &dfs_fops);
593
- if (IS_ERR_OR_NULL(dent))
594
- goto out_remove;
595
- d->dfs_power_cut_min = dent;
550
+ d->dfs_power_cut_min = debugfs_create_file("tst_emulate_power_cut_min",
551
+ S_IWUSR, d->dfs_dir,
552
+ (void *)ubi_num, &dfs_fops);
596553
597
- fname = "tst_emulate_power_cut_max";
598
- dent = debugfs_create_file(fname, S_IWUSR, d->dfs_dir, (void *)ubi_num,
599
- &dfs_fops);
600
- if (IS_ERR_OR_NULL(dent))
601
- goto out_remove;
602
- d->dfs_power_cut_max = dent;
554
+ d->dfs_power_cut_max = debugfs_create_file("tst_emulate_power_cut_max",
555
+ S_IWUSR, d->dfs_dir,
556
+ (void *)ubi_num, &dfs_fops);
603557
604
- fname = "detailed_erase_block_info";
605
- dent = debugfs_create_file(fname, S_IRUSR, d->dfs_dir, (void *)ubi_num,
606
- &eraseblk_count_fops);
607
- if (IS_ERR_OR_NULL(dent))
608
- goto out_remove;
558
+ debugfs_create_file("detailed_erase_block_info", S_IRUSR, d->dfs_dir,
559
+ (void *)ubi_num, &eraseblk_count_fops);
609560
610561 return 0;
611
-
612
-out_remove:
613
- debugfs_remove_recursive(d->dfs_dir);
614
-out:
615
- err = dent ? PTR_ERR(dent) : -ENODEV;
616
- ubi_err(ubi, "cannot create \"%s\" debugfs file or directory, error %d\n",
617
- fname, err);
618
- return err;
619562 }
620563
621564 /**