[U-Boot] [PATCHv2 2/3] spl: Lightweight UBI and UBI fastmap support

Marek Vasut marex at denx.de
Wed Jan 6 18:09:21 CET 2016


On Wednesday, January 06, 2016 at 05:52:04 PM, Ladislav Michl wrote:
> 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)

The MW opens mid-January or so, so that's fine.

I'm leaving review of the MTD parts to the more experienced people.

> 	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,

Best regards,
Marek Vasut


More information about the U-Boot mailing list