[patch] mtd/sst25l: check for null consistently

Dan Carpenter error27 at gmail.com
Sat May 22 16:16:26 EDT 2010


The rest of the function assumes that "data" can be null.  I don't know
the code well enough to say whether it can actually be null, but there 
is no harm in checking here.

Signed-off-by: Dan Carpenter <error27 at gmail.com>

diff --git a/drivers/mtd/devices/sst25l.c b/drivers/mtd/devices/sst25l.c
index ab5d8cd..684247a 100644
--- a/drivers/mtd/devices/sst25l.c
+++ b/drivers/mtd/devices/sst25l.c
@@ -454,7 +454,7 @@ static int __init sst25l_probe(struct spi_device *spi)
 						  parts, nr_parts);
 		}
 
-	} else if (data->nr_parts) {
+	} else if (data && data->nr_parts) {
 		dev_warn(&spi->dev, "ignoring %d default partitions on %s\n",
 			 data->nr_parts, data->name);
 	}



More information about the linux-mtd mailing list