mtd: sst25l: check for null consistently

Linux-MTD Mailing List linux-mtd at lists.infradead.org
Wed Aug 4 06:59:01 EDT 2010


Gitweb:     http://git.infradead.org/?p=mtd-2.6.git;a=commit;h=a4b81ca50974051195b11ca173da073b961f94d5
Commit:     a4b81ca50974051195b11ca173da073b961f94d5
Parent:     00b275dbfc2ae3e3312a910736dd9a6bd5110c2b
Author:     Dan Carpenter <error27 at gmail.com>
AuthorDate: Sat May 22 22:16:26 2010 +0200
Committer:  David Woodhouse <David.Woodhouse at intel.com>
CommitDate: Mon Aug 2 09:00:45 2010 +0100

    mtd: sst25l: check for null consistently
    
    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>
    Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy at nokia.com>
    Signed-off-by: David Woodhouse <David.Woodhouse at intel.com>
---
 drivers/mtd/devices/sst25l.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

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-cvs mailing list