From: Ladislav Michl <ladis@linux-mips.org>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCHv2 2/3] spl: Lightweight UBI and UBI fastmap support
Date: Wed, 6 Jan 2016 17:52:04 +0100 [thread overview]
Message-ID: <20160106165204.GA29297@localhost.localdomain> (raw)
In-Reply-To: <20160104155615.GC4376@localhost.localdomain>
Hi,
I cannot work on ubispl till next week, so just one quick additional patch
before v3 in case anyone wants to give it a try.
Move vol_id check to ubi_scan_vid_hdr to verify it has meaningfull value
before testing ubi->toload (in my case 0x7FFFEFFF was read causing test_bit
hang)
ladis
diff --git a/drivers/mtd/ubispl/ubispl.c b/drivers/mtd/ubispl/ubispl.c
index a779759..c38beb7 100644
--- a/drivers/mtd/ubispl/ubispl.c
+++ b/drivers/mtd/ubispl/ubispl.c
@@ -123,19 +123,12 @@ static int ubi_rescan_fm_vid_hdr(struct ubi_scan_info *ubi,
/* Insert the logic block into the volume info */
static int ubi_add_peb_to_vol(struct ubi_scan_info *ubi,
struct ubi_vid_hdr *vh, u32 vol_id,
- u32 vol_type, u32 pnum, u32 lnum)
+ u32 pnum, u32 lnum)
{
struct ubi_vol_info *vi = ubi->volinfo + vol_id;
u32 *ltp;
/*
- * We only care about static volumes with an id <
- * UBI_SPL_VOL_IDS.
- */
- if (vol_id >= UBI_SPL_VOL_IDS || vol_type != UBI_VID_STATIC)
- return 0;
-
- /*
* If the volume is larger than expected, yell and give up :(
*/
if (lnum >= UBI_MAX_VOL_LEBS) {
@@ -218,13 +211,16 @@ static int ubi_scan_vid_hdr(struct ubi_scan_info *ubi, struct ubi_vid_hdr *vh,
if (vol_id == UBI_FM_SB_VOLUME_ID)
return ubi->fm_enabled ? UBI_FASTMAP_ANCHOR : 0;
+ /* We only care about static volumes with an id < UBI_SPL_VOL_IDS */
+ if (vol_id >= UBI_SPL_VOL_IDS || vh->vol_type != UBI_VID_STATIC)
+ return 0;
+
/* We are only interested in the volumes to load */
if (!test_bit(vol_id, ubi->toload))
return 0;
lnum = be32_to_cpu(vh->lnum);
-
- return ubi_add_peb_to_vol(ubi, vh, vol_id, vh->vol_type, pnum, lnum);
+ return ubi_add_peb_to_vol(ubi, vh, vol_id, pnum, lnum);
}
static int assign_aeb_to_av(struct ubi_scan_info *ubi, u32 pnum, u32 lnum,
next prev parent reply other threads:[~2016-01-06 16:52 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-04 15:52 [U-Boot] [PATCHv2 0/3] spl: Lightweight UBI and UBI fastmap support Ladislav Michl
2016-01-04 15:54 ` [U-Boot] [PATCHv2 1/3] nand_spl_simple: Add a simple flash read function Ladislav Michl
2016-01-04 17:19 ` Marek Vasut
2016-01-04 17:58 ` Ladislav Michl
2016-01-04 18:38 ` Marek Vasut
2016-01-04 18:23 ` Scott Wood
2016-01-04 18:38 ` Ladislav Michl
2016-01-04 18:44 ` Scott Wood
2016-01-04 21:17 ` Ladislav Michl
2016-01-04 21:45 ` Scott Wood
2016-01-04 22:40 ` Marek Vasut
2016-01-04 22:42 ` Scott Wood
2016-01-04 22:52 ` Marek Vasut
2016-01-04 15:56 ` [U-Boot] [PATCHv2 2/3] spl: Lightweight UBI and UBI fastmap support Ladislav Michl
2016-01-06 16:52 ` Ladislav Michl [this message]
2016-01-06 17:09 ` Marek Vasut
2016-01-04 15:57 ` [U-Boot] [PATCHv2 3/3] igep00x0: UBIize Ladislav Michl
2016-01-07 10:47 ` [U-Boot] [PATCHv2 0/3] spl: Lightweight UBI and UBI fastmap support Heiko Schocher
2016-01-10 14:00 ` Ladislav Michl
2016-01-11 5:50 ` Heiko Schocher
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20160106165204.GA29297@localhost.localdomain \
--to=ladis@linux-mips.org \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox