diff mbox

[v3,5/9] mtd: nand: tmio_nand.c: take in account partition parser types

Message ID 1496270458-6479-6-git-send-email-andrea.adami@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Andrea Adami May 31, 2017, 10:40 p.m. UTC
Signed-off-by: Andrea Adami <andrea.adami@gmail.com>
---
 drivers/mtd/nand/tmio_nand.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Wolfram Sang June 1, 2017, 8:37 a.m. UTC | #1
> -	retval = mtd_device_parse_register(mtd, NULL, NULL,
> +	retval = mtd_device_parse_register(mtd,
> +					   data->types ? data->types : NULL,

This is superfluous. You want to check against 'data' instead as it is
done below. Otherwis you might get a NULL pointer dereference.

> +					   NULL,
>  					   data ? data->partition : NULL,
>  					   data ? data->num_partitions : 0);
diff mbox

Patch

diff --git a/drivers/mtd/nand/tmio_nand.c b/drivers/mtd/nand/tmio_nand.c
index fc5e773..bea05bb 100644
--- a/drivers/mtd/nand/tmio_nand.c
+++ b/drivers/mtd/nand/tmio_nand.c
@@ -440,7 +440,9 @@  static int tmio_probe(struct platform_device *dev)
 		goto err_irq;
 
 	/* Register the partitions */
-	retval = mtd_device_parse_register(mtd, NULL, NULL,
+	retval = mtd_device_parse_register(mtd,
+					   data->types ? data->types : NULL,
+					   NULL,
 					   data ? data->partition : NULL,
 					   data ? data->num_partitions : 0);
 	if (!retval)