hc
2024-05-10 ee930fffee469d076998274a2ca55e13dc1efb67
kernel/drivers/mtd/nftlmount.c
....@@ -1,23 +1,10 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * NFTL mount code with extensive checks
34 *
45 * Author: Fabrice Bellard (fabrice.bellard@netgem.com)
56 * Copyright © 2000 Netgem S.A.
67 * Copyright © 1999-2010 David Woodhouse <dwmw2@infradead.org>
7
- *
8
- * This program is free software; you can redistribute it and/or modify
9
- * it under the terms of the GNU General Public License as published by
10
- * the Free Software Foundation; either version 2 of the License, or
11
- * (at your option) any later version.
12
- *
13
- * This program is distributed in the hope that it will be useful,
14
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
- * GNU General Public License for more details.
17
- *
18
- * You should have received a copy of the GNU General Public License
19
- * along with this program; if not, write to the Free Software
20
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
218 */
229
2310 #include <linux/kernel.h>
....@@ -346,25 +333,26 @@
346333 goto fail;
347334 }
348335
349
- /* increase and write Wear-Leveling info */
350
- nb_erases = le32_to_cpu(uci.WearInfo);
351
- nb_erases++;
336
+ /* increase and write Wear-Leveling info */
337
+ nb_erases = le32_to_cpu(uci.WearInfo);
338
+ nb_erases++;
352339
353
- /* wrap (almost impossible with current flash) or free block */
354
- if (nb_erases == 0)
355
- nb_erases = 1;
340
+ /* wrap (almost impossible with current flash) or free block */
341
+ if (nb_erases == 0)
342
+ nb_erases = 1;
356343
357
- /* check the "freeness" of Erase Unit before updating metadata
358
- * FixMe: is this check really necessary ? since we have check the
359
- * return code after the erase operation. */
360
- if (check_free_sectors(nftl, instr->addr, nftl->EraseSize, 1) != 0)
361
- goto fail;
344
+ /* check the "freeness" of Erase Unit before updating metadata
345
+ * FixMe: is this check really necessary ? since we have check the
346
+ * return code after the erase operation.
347
+ */
348
+ if (check_free_sectors(nftl, instr->addr, nftl->EraseSize, 1) != 0)
349
+ goto fail;
362350
363
- uci.WearInfo = le32_to_cpu(nb_erases);
364
- if (nftl_write_oob(mtd, block * nftl->EraseSize + SECTORSIZE +
365
- 8, 8, &retlen, (char *)&uci) < 0)
366
- goto fail;
367
- return 0;
351
+ uci.WearInfo = le32_to_cpu(nb_erases);
352
+ if (nftl_write_oob(mtd, block * nftl->EraseSize + SECTORSIZE +
353
+ 8, 8, &retlen, (char *)&uci) < 0)
354
+ goto fail;
355
+ return 0;
368356 fail:
369357 /* could not format, update the bad block table (caller is responsible
370358 for setting the ReplUnitTable to BLOCK_RESERVED on failure) */