mtd: sst25l: check for null consistently
authorDan Carpenter <error27@gmail.com>
Sat, 22 May 2010 20:16:26 +0000 (22:16 +0200)
committerDavid Woodhouse <David.Woodhouse@intel.com>
Mon, 2 Aug 2010 08:00:45 +0000 (09:00 +0100)
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@gmail.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
drivers/mtd/devices/sst25l.c

index ab5d8cd02a15aa1e5e8f53485bb9ec85916061b3..684247a8a5edafa720e102014595d15c7b500181 100644 (file)
@@ -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);
        }