#
025a06c1 |
|
25-Mar-2020 |
Miquel Raynal <miquel.raynal@bootlin.com> |
mtd: Convert fallthrough comments into statements Use Joe Perches cvt_fallthrough.pl script to convert /* fallthrough */ comments (and its derivatives) into a fallthrough; statement. This automatically drops useless ones. Do it MTD-wide. Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Acked-by: Vignesh Raghavendra <vigneshr@ti.com> Acked-by: Tudor Ambarus <tudor.ambarus@microchip.com> Acked-by: Richard Weinberger <richard@nod.at> Link: https://lore.kernel.org/linux-mtd/20200325212115.14170-1-miquel.raynal@bootlin.com
|
#
fc55dacf |
|
30-Nov-2019 |
Hou Tao <houtao1@huawei.com> |
ubi: Free the normal volumes in error paths of ubi_attach_mtd_dev() The allocated normal volumes saved in ubi->volumes are not freed in the error paths in ubi_attach_mtd_dev() and its callees (e.g. ubi_attach() and ubi_read_volume_table()). These normal volumes should be freed through kill_volumes() and vol_release(), but ubi_attach_mtd_dev() may fail before calling uif_init(), and there will be memory leaks. So adding a new helper ubi_free_all_volumes() to free the normal and the internal volumes. And in order to prevent double-free of volume, reset ubi->volumes[i] to NULL after freeing. Signed-off-by: Hou Tao <houtao1@huawei.com> Signed-off-by: Richard Weinberger <richard@nod.at>
|
#
1a59d1b8 |
|
27-May-2019 |
Thomas Gleixner <tglx@linutronix.de> |
treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 156 Based on 1 normalized pattern(s): this program is free software you can redistribute it and or modify it under the terms of the gnu general public license as published by the free software foundation either version 2 of the license or at your option any later version this program is distributed in the hope that it will be useful but without any warranty without even the implied warranty of merchantability or fitness for a particular purpose see the gnu general public license for more details you should have received a copy of the gnu general public license along with this program if not write to the free software foundation inc 59 temple place suite 330 boston ma 02111 1307 usa extracted by the scancode license scanner the SPDX license identifier GPL-2.0-or-later has been chosen to replace the boilerplate/reference in 1334 file(s). Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Allison Randal <allison@lohutok.net> Reviewed-by: Richard Fontana <rfontana@redhat.com> Cc: linux-spdx@vger.kernel.org Link: https://lkml.kernel.org/r/20190527070033.113240726@linutronix.de Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
|
#
7e5583fd |
|
05-Oct-2018 |
Gustavo A. R. Silva <gustavo@embeddedor.com> |
ubi: Mark expected switch fall-throughs In preparation to enabling -Wimplicit-fallthrough, mark switch cases where we are expecting to fall through. Addresses-Coverity-ID: 1373884 ("Missing break in switch") Addresses-Coverity-ID: 114869 ("Missing break in switch") Addresses-Coverity-ID: 114870 ("Missing break in switch") Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com> Signed-off-by: Richard Weinberger <richard@nod.at>
|
#
3291b52f |
|
16-Sep-2016 |
Boris Brezillon <bbrezillon@kernel.org> |
UBI: introduce the VID buffer concept Currently, all VID headers are allocated and freed using the ubi_zalloc_vid_hdr() and ubi_free_vid_hdr() function. These functions make sure to align allocation on ubi->vid_hdr_alsize and adjust the vid_hdr pointer to match the ubi->vid_hdr_shift requirements. This works fine, but is a bit convoluted. Moreover, the future introduction of LEB consolidation (needed to support MLC/TLC NANDs) will allows a VID buffer to contain more than one VID header. Hence the creation of a ubi_vid_io_buf struct to attach extra information to the VID header. We currently only store the actual pointer of the underlying buffer, but will soon add the number of VID headers contained in the buffer. Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com> Signed-off-by: Richard Weinberger <richard@nod.at>
|
#
7b6b749b |
|
16-Sep-2016 |
Boris Brezillon <bbrezillon@kernel.org> |
UBI: move the global ech and vidh variables into struct ubi_attach_info Even if it works fine with those global variables, attaching the temporary ech and vidh objects used during UBI scan to the ubi_attach_info object sounds like a more future-proof option. For example, attaching several UBI devices in parallel is prevented by this use of global variable. And also because global variables should be avoided in general. Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com> Signed-off-by: Richard Weinberger <richard@nod.at>
|
#
91f4285f |
|
16-Sep-2016 |
Boris Brezillon <bbrezillon@kernel.org> |
UBI: provide helpers to allocate and free aeb elements This not only hides the aeb allocation internals (which is always good in case we ever want to change the allocation system), but also helps us factorize the initialization of some common fields (ec and pnum). Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com> Signed-off-by: Richard Weinberger <richard@nod.at>
|
#
f9efe8d8 |
|
16-Sep-2016 |
Boris Brezillon <bbrezillon@kernel.org> |
UBI: factorize destroy_av() and ubi_remove_av() code Those functions are pretty much doing the same thing, except ubi_remove_av() is putting the aeb elements attached to the volume into the ai->erase list and the destroy_av() is freeing them. Rework destroy_av() to handle both cases. Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com> Signed-off-by: Richard Weinberger <richard@nod.at>
|
#
de4c455b |
|
16-Sep-2016 |
Boris Brezillon <bbrezillon@kernel.org> |
UBI: factorize code used to manipulate volumes at attach time Volume creation/search code is duplicated in a few places (fastmap and non fastmap code). Create some helpers to factorize the code. Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com> Signed-off-by: Richard Weinberger <richard@nod.at>
|
#
3f84e454 |
|
16-Sep-2016 |
Boris Brezillon <bbrezillon@kernel.org> |
UBI: fix add_fastmap() to use the vid_hdr passed in argument add_fastmap() is passed a ubi_vid_hdr pointer in argument, but is referencing the global vidh pointer. Even if this is correct from a functional point of view (vidh and vid_hdr point to the same object), it is confusing. Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com> Signed-off-by: Richard Weinberger <richard@nod.at>
|
#
74f2c6e9 |
|
14-Jun-2016 |
Richard Weinberger <richard@nod.at> |
ubi: Be more paranoid while seaching for the most recent Fastmap Since PEB erasure is asynchornous it can happen that there is more than one Fastmap on the MTD. This is fine because the attach logic will pick the Fastmap data structure with the highest sequence number. On a not so well configured MTD stack spurious ECC errors are common. Causes can be different, bad hardware, wrong operating modes, etc... If the most current Fastmap renders bad due to ECC errors UBI might pick an older Fastmap to attach from. While this can only happen on an anyway broken setup it will show completely different sympthoms and makes finding the root cause much more difficult. So, be debug friendly and fall back to scanning mode of we're facing an ECC error while scanning for Fastmap. Cc: <stable@vger.kernel.org> Signed-off-by: Richard Weinberger <richard@nod.at>
|
#
fdf10ed7 |
|
14-Jun-2016 |
Richard Weinberger <richard@nod.at> |
ubi: Rework Fastmap attach base code Introduce a new list to the UBI attach information object to be able to deal better with old and corrupted Fastmap eraseblocks. Also move more Fastmap specific code into fastmap.c. Signed-off-by: Richard Weinberger <richard@nod.at>
|
#
243a4f81 |
|
14-Jun-2016 |
Richard Weinberger <richard@nod.at> |
ubi: Introduce vol_ignored() This makes the logic more easy to follow. Signed-off-by: Richard Weinberger <richard@nod.at>
|
#
d139d300 |
|
14-Jun-2016 |
Richard Weinberger <richard@nod.at> |
ubi: Fix scan_fast() comment Signed-off-by: Richard Weinberger <richard@nod.at>
|
#
f9a113d6 |
|
13-Sep-2015 |
Julia Lawall <julia.lawall@lip6.fr> |
UBI: drop null test before destroy functions Remove unneeded NULL test. The semantic patch that makes this change is as follows: (http://coccinelle.lip6.fr/) // <smpl> @@ expression x; @@ -if (x != NULL) \(kmem_cache_destroy\|mempool_destroy\|dma_pool_destroy\)(x); // </smpl> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr> Signed-off-by: Richard Weinberger <richard@nod.at>
|
#
180a5357 |
|
09-Mar-2015 |
Richard Weinberger <richard@nod.at> |
UBI: Fastmap: Fall back to scanning mode after ECC error If we encounter an uncorrectable ECC error while scanning for the fastmap UBI must not fail hard. Instead fall back to scanning mode. Reported-by: Alexander Block <Alexander.Block@continental-corporation.com> Signed-off-by: Richard Weinberger <richard@nod.at>
|
#
560d86a1 |
|
27-Oct-2014 |
Richard Weinberger <richard@nod.at> |
UBI: Fastmap: Make self_check_eba() depend on fastmap self checking ...instead of generic self checking. Signed-off-by: Richard Weinberger <richard@nod.at>
|
#
d2158f69 |
|
06-Oct-2014 |
Richard Weinberger <richard@nod.at> |
UBI: Remove alloc_ai() slab name from parameter list There is always exactly one ubi_attach_info object allocated, therefore we don't have to care about the name. Signed-off-by: Richard Weinberger <richard@nod.at>
|
#
98105d08 |
|
06-Oct-2014 |
Richard Weinberger <richard@nod.at> |
UBI: Fastmap: Fix memory leak while attaching Currently we leak a few ubi_ainf_pebs while attaching. Signed-off-by: Richard Weinberger <richard@nod.at>
|
#
8eef7d70 |
|
28-Feb-2015 |
Brian Norris <computersforpeace@gmail.com> |
UBI: account for bitflips in both the VID header and data We are completely discarding the earlier value of 'bitflips', which could reflect a bitflip found in ubi_io_read_vid_hdr(). Let's use the bitwise OR of header and data 'bitflip' statuses instead. Coverity CID #1226856 Cc: stable <stable@vger.kernel.org> Signed-off-by: Brian Norris <computersforpeace@gmail.com> Signed-off-by: Richard Weinberger <richard@nod.at>
|
#
32608703 |
|
20-Oct-2014 |
Tanya Brokhman <tlinder@codeaurora.org> |
UBI: Extend UBI layer debug/messaging capabilities If there is more then one UBI device mounted, there is no way to distinguish between messages from different UBI devices. Add device number to all ubi layer message types. The R/O block driver messages were replaced by pr_* since ubi_device structure is not used by it. Amended a bit by Artem. Signed-off-by: Tanya Brokhman <tlinder@codeaurora.org> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
|
#
4d525145 |
|
29-Dec-2013 |
Julia Lawall <Julia.Lawall@lip6.fr> |
UBI: fix error return code Set the return variable to an error code as done elsewhere in the function. A simplified version of the semantic match that finds this problem is as follows: (http://coccinelle.lip6.fr/) // <smpl> ( if@p1 (\(ret < 0\|ret != 0\)) { ... return ret; } | ret@p1 = 0 ) ... when != ret = e1 when != &ret *if(...) { ... when != ret = e2 when forall return ret; } // </smpl> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr> Reviewed-by: Richard Weinberger <richard@nod.at>
|
#
55b80c40 |
|
28-Sep-2013 |
Richard Genoud <richard.genoud@gmail.com> |
UBI: simplify image sequence test The test: if (!a && b) a = b; can be symplified in: if (!a) a = b; And there's no need to test if ubi->image_seq is not null, because if it is, it is set to image_seq. So, we just test if image_seq is not null. Signed-off-by: Richard Genoud <richard.genoud@gmail.com> Signed-off-by: Richard Weinberger <richard@nod.at> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
|
#
4b3e0a25 |
|
28-Sep-2013 |
Richard Weinberger <richard@nod.at> |
UBI: Call scan_all() with correct offset in error case If we find an invalid fastmap we have to scan from the very beginning. Otherwise we leak the first 64 PEBs. Reported-and-tested-by: Richard Genoud <richard.genoud@gmail.com> Signed-off-by: Richard Weinberger <richard@nod.at> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
|
#
64575574 |
|
28-Nov-2012 |
Ezequiel Garcia <elezegarcia@gmail.com> |
UBI: introduce helpers dbg_chk_{io, gen} With this patch code is a bit more readable and there's no generated code or functionality impact. Furthermore, this abstracts implementation details and will allow to change ubi_debug_info in a less invasive way. Signed-off-by: Ezequiel Garcia <elezegarcia@gmail.com> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
|
#
d125a753 |
|
26-Oct-2012 |
Artem Bityutskiy <artem.bityutskiy@linux.intel.com> |
UBI: do not allocate the memory unnecessarily UBI reserves an LEB sized buffer for various needs. We can use this buffer while scanning, instead of allocating another one. This patch was originally created by Jan Luebbe <jlu@pengutronix.de>, but then he dropped it and I picked up and tweaked a little bit. Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
|
#
dac6e208 |
|
26-Sep-2012 |
Richard Weinberger <richard@nod.at> |
UBI: Add fastmap stuff to attach.c - Export compare_lebs() as fastmap needs this function. - Implement fastmap scan logic. Signed-off-by: Richard Weinberger <richard@nod.at> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
|
#
55393ba1 |
|
31-Aug-2012 |
Brian Norris <computersforpeace@gmail.com> |
UBI: fix trivial typo 'it' => 'is' Signed-off-by: Brian Norris <computersforpeace@gmail.com> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
|
#
719bb840 |
|
27-Aug-2012 |
Artem Bityutskiy <artem.bityutskiy@linux.intel.com> |
UBI: print less UBI currently prints a lot of information when it mounts a volume, which bothers some people. Make it less chatty - print only important information by default. Get rid of 'dbg_msg()' macro completely. Reported-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
|
#
e28453bb |
|
27-Aug-2012 |
Artem Bityutskiy <artem.bityutskiy@linux.intel.com> |
UBI: use pr_ helper instead of printk Use 'pr_err()' instead of 'printk(KERN_ERR', etc. Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
|
#
049333ce |
|
27-Aug-2012 |
Artem Bityutskiy <artem.bityutskiy@linux.intel.com> |
UBI: comply with coding style Join all the split printk lines in order to stop checkpatch complaining. Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
|
#
193819cf |
|
22-Aug-2012 |
Matthieu CASTET <matthieu.castet@parrot.com> |
UBI: erase free PEB with bitflip in EC header Without this patch, these PEB are not scrubbed until we put data in them. Bitflip can accumulate latter and we can loose the EC header (but VID header should be intact and allow to recover data). Signed-off-by: Matthieu Castet <matthieu.castet@parrot.com> Cc: stable@vger.kernel.org Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
|
#
6dd3bc7e |
|
16-May-2012 |
Joel Reardon <joel@clambassador.com> |
UBI: add volume id struct ubi_ainf_peb This patch adds the volume id to struct ubi_ainf_peb when scanning the LEBs at startup. PEBs now added to the erase queue will know their original LEB number and volume id, if available, and will be -1 otherwise (for instance, if the VID header is unreadable). This was tested by creating an ubi device with 3 volumes and disabiling the ubi_thread's do_work functionality. The different ubi volumes were formatted to ubifs and had files created and erased. The ubi modules was reloaded and the list of LEB's added to the erased list was outputted, confirming the volume ids and LEB numbers were appropriate. Signed-off-by: Joel Reardon <reardonj@inf.ethz.ch> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
|
#
ae4a8104 |
|
18-May-2012 |
Artem Bityutskiy <artem.bityutskiy@linux.intel.com> |
UBI: rename scan.c to attach.c Finally, rename the scan.c file. Now adding fastmap support won't look that hacky anymore. Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
|