From patchwork Mon Aug 20 12:09:17 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [v2,3/7] UBI: accept empty string for vid_hdr_offs parameter From: Richard Genoud X-Patchwork-Id: 178755 Message-Id: <1345464561-24464-4-git-send-email-richard.genoud@gmail.com> To: Artem Bityutskiy Cc: Richard Genoud , linux-mtd@lists.infradead.org, Shmulik Ladkani Date: Mon, 20 Aug 2012 14:09:17 +0200 as a new parameter (max_beb_per1024) will come in next patches, it's better to accept empty string value so that we can do: mtd.ubi=2,,25 Signed-off-by: Richard Genoud --- drivers/mtd/ubi/build.c | 6 +++++- 1 files changed, 5 insertions(+), 1 deletions(-) diff --git a/drivers/mtd/ubi/build.c b/drivers/mtd/ubi/build.c index 3c0b91f..cc0a4fa 100644 --- a/drivers/mtd/ubi/build.c +++ b/drivers/mtd/ubi/build.c @@ -1292,7 +1292,11 @@ static int __init bytes_str_to_int(const char *str) unsigned long result; result = simple_strtoul(str, &endp, 0); - if (str == endp || result >= INT_MAX) { + if (str == endp) + /* empty string, assume it's 0 */ + return 0; + + if (result >= INT_MAX) { printk(KERN_ERR "UBI error: incorrect bytes count: \"%s\"\n", str); return -EINVAL;