[PATCH v2 3/7] UBI: accept empty string for vid_hdr_offs parameter

Shmulik Ladkani shmulik.ladkani at gmail.com
Tue Aug 21 16:19:33 EDT 2012


On Mon, 20 Aug 2012 16:04:58 +0300 Artem Bityutskiy <dedekind1 at gmail.com> wrote:
> Please, let's not over-engineer this, do not bother with ",,", use ",0,"
> instead. Just do amend the documentation properly.

Artem, you are probably right, but it was really a one-liner:

diff --git a/drivers/mtd/ubi/build.c b/drivers/mtd/ubi/build.c
index 2c5ed5c..1745764 100644
--- a/drivers/mtd/ubi/build.c
+++ b/drivers/mtd/ubi/build.c
@@ -1333,7 +1333,7 @@ static int __init ubi_mtd_param_parse(const char *val, struct kernel_param *kp)
 	p = &mtd_dev_param[mtd_devs];
 	strcpy(&p->name[0], tokens[0]);
 
-	if (tokens[1])
+	if (tokens[1] && *tokens[1] != '\0')
 		p->vid_hdr_offs = bytes_str_to_int(tokens[1]);
 
 	if (p->vid_hdr_offs < 0)


But either case, I guess the user will probably still need to take a
look at the description to understand how to "avoid specifying" the
vid_hdr_offs ;-)
So no real benefit supporting ",,"
Bit more intuitive, though.

Anyways, saw you already pushed, thanks.

Shmulik



More information about the linux-mtd mailing list