From patchwork Wed Jan 6 16:52:04 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ladislav Michl X-Patchwork-Id: 563988 X-Patchwork-Delegate: hs@denx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 056B414009B for ; Thu, 7 Jan 2016 03:52:22 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id DB1EF4B8AD; Wed, 6 Jan 2016 17:52:18 +0100 (CET) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id FORLyzwFoKrG; Wed, 6 Jan 2016 17:52:18 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 717494B7EF; Wed, 6 Jan 2016 17:52:18 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id B11D24B7E5 for ; Wed, 6 Jan 2016 17:52:16 +0100 (CET) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id dhYmvjH-d8G7 for ; Wed, 6 Jan 2016 17:52:16 +0100 (CET) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from cvs.linux-mips.org (eddie.linux-mips.org [148.251.95.138]) by theia.denx.de (Postfix) with ESMTP id 7CFAF4B7C5 for ; Wed, 6 Jan 2016 17:52:12 +0100 (CET) Received: (from localhost user: 'ladis' uid#1021 fake: STDIN (ladis@eddie.linux-mips.org)) by eddie.linux-mips.org id S27009896AbcAFQwMXwSNv (ORCPT ); Wed, 6 Jan 2016 17:52:12 +0100 Date: Wed, 6 Jan 2016 17:52:04 +0100 From: Ladislav Michl To: u-boot@lists.denx.de Message-ID: <20160106165204.GA29297@localhost.localdomain> References: <20160104155242.GA4376@localhost.localdomain> <20160104155615.GC4376@localhost.localdomain> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20160104155615.GC4376@localhost.localdomain> User-Agent: Mutt/1.5.23 (2014-03-12) Cc: Marek Vasut , Tom Rini , Richard Weinberger , Scott Wood Subject: Re: [U-Boot] [PATCHv2 2/3] spl: Lightweight UBI and UBI fastmap support X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.15 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" 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,