[patch 1/4] mtd/sst25l: check for null consistently

akpm at linux-foundation.org akpm at linux-foundation.org
Tue Jul 20 18:23:59 EDT 2010


From: Dan Carpenter <error27 at gmail.com>

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>
Cc: Artem Bityutskiy <Artem.Bityutskiy at nokia.com>
Cc: Andre Renaud <andre at bluewatersys.com>
Cc: David Woodhouse <dwmw2 at infradead.org>
Signed-off-by: Andrew Morton <akpm at linux-foundation.org>
---

 drivers/mtd/devices/sst25l.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff -puN drivers/mtd/devices/sst25l.c~mtd-sst25l-check-for-null-consistently drivers/mtd/devices/sst25l.c
--- a/drivers/mtd/devices/sst25l.c~mtd-sst25l-check-for-null-consistently
+++ a/drivers/mtd/devices/sst25l.c
@@ -454,7 +454,7 @@ static int __init sst25l_probe(struct sp
 						  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