hc
2024-05-13 9d77db3c730780c8ef5ccd4b66403ff5675cfe4e
kernel/drivers/mtd/ubi/eba.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 */
....@@ -612,7 +599,7 @@
612599 int err, pnum, scrub = 0, vol_id = vol->vol_id;
613600 struct ubi_vid_io_buf *vidb;
614601 struct ubi_vid_hdr *vid_hdr;
615
- uint32_t uninitialized_var(crc);
602
+ uint32_t crc;
616603
617604 err = leb_read_lock(ubi, vol_id, lnum);
618605 if (err)
....@@ -960,7 +947,7 @@
960947 int offset, int len)
961948 {
962949 struct ubi_device *ubi = vol->ubi;
963
- int pnum, opnum, err, vol_id = vol->vol_id;
950
+ int pnum, opnum, err, err2, vol_id = vol->vol_id;
964951
965952 pnum = ubi_wl_get_peb(ubi);
966953 if (pnum < 0) {
....@@ -995,10 +982,19 @@
995982 out_put:
996983 up_read(&ubi->fm_eba_sem);
997984
998
- if (err && pnum >= 0)
999
- err = ubi_wl_put_peb(ubi, vol_id, lnum, pnum, 1);
1000
- else if (!err && opnum >= 0)
1001
- err = ubi_wl_put_peb(ubi, vol_id, lnum, opnum, 0);
985
+ if (err && pnum >= 0) {
986
+ err2 = ubi_wl_put_peb(ubi, vol_id, lnum, pnum, 1);
987
+ if (err2) {
988
+ ubi_warn(ubi, "failed to return physical eraseblock %d, error %d",
989
+ pnum, err2);
990
+ }
991
+ } else if (!err && opnum >= 0) {
992
+ err2 = ubi_wl_put_peb(ubi, vol_id, lnum, opnum, 0);
993
+ if (err2) {
994
+ ubi_warn(ubi, "failed to return physical eraseblock %d, error %d",
995
+ opnum, err2);
996
+ }
997
+ }
1002998
1003999 return err;
10041000 }