UBI: bugfix: dont oops with NULL module parameter
E.g., it oopsed in case of: modprobe ubi mtd = 0
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
diff --git a/drivers/mtd/ubi/build.c b/drivers/mtd/ubi/build.c
index 9b94427..b85ca18 100644
--- a/drivers/mtd/ubi/build.c
+++ b/drivers/mtd/ubi/build.c
@@ -845,6 +845,9 @@
char *pbuf = &buf[0];
char *tokens[3] = {NULL, NULL, NULL};
+ if (!val)
+ return -EINVAL;
+
if (mtd_devs == UBI_MAX_DEVICES) {
printk("UBI error: too many parameters, max. is %d\n",
UBI_MAX_DEVICES);