lkml.org 
[lkml]   [2016]   [Nov]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [RESEND PATCH v5 2/5] mtd: ubi: use 'max_bad_blocks' to compute bad_peb_limit if available
On Mon, Nov 21, 2016 at 01:51:36PM -0600, Zach Brown wrote:
> From: Jeff Westfahl <jeff.westfahl@ni.com>
>
> Use the MTD function 'max_bad_blocks' to compute the UBI bad_peb_limit,
> if the function is implemented for an MTD and doesn't return an error.
>
> Signed-off-by: Jeff Westfahl <jeff.westfahl@ni.com>
> Signed-off-by: Zach Brown <zach.brown@ni.com>
> Acked-by: Boris Brezillon <boris.brezillon@free-electron.com>
> ---
> drivers/mtd/ubi/build.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/drivers/mtd/ubi/build.c b/drivers/mtd/ubi/build.c
> index 85d54f3..e9940a9 100644
> --- a/drivers/mtd/ubi/build.c
> +++ b/drivers/mtd/ubi/build.c
> @@ -584,6 +584,10 @@ static int get_bad_peb_limit(const struct ubi_device *ubi, int max_beb_per1024)
> int limit, device_pebs;
> uint64_t device_size;
>
> + limit = mtd_max_bad_blocks(ubi->mtd, 0, ubi->mtd->size);
> + if (limit > 0)

I guess we're assuming 0 is an erroneous value? Otherwise, why would
mtd_can_have_bb() be true?

Brian

> + return limit;
> +
> if (!max_beb_per1024)
> return 0;
>
> --
> 2.7.4
>

\
 
 \ /
  Last update: 2016-11-22 19:51    [W:0.086 / U:0.288 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site