H Hartley Sweeten d4702669b0 mtd: fix memory leak in mtd_dataflash
Fix a potential memory leak in mtd_dataflash driver.

The private data that is allocated when registering a DataFlash
device with the MTD subsystem is not released if an error occurs
when add_mtd_partitions() or add_mtd_device() is called.  Fix this
by adding an error path.  The memory is already released during a
remove.

Also, add a dev_set_drvdata(&spi->dev, NULL) before the kfree() so
that the spi device does not reference invalid data.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: David Brownell <david-b@pacbell.net>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2009-10-17 15:41:11 +01:00
..
2009-03-20 13:16:26 +00:00
2009-03-20 13:16:26 +00:00
2009-03-20 13:16:26 +00:00
2008-06-04 17:50:17 +01:00
2008-06-04 17:50:17 +01:00
2009-09-23 10:07:49 -07:00
2009-09-19 10:56:53 -07:00