Skip to contentSkip to conversation

mtd: dataflash: remove unnecessary spi_set_drvdata()

PATCH Applied Jingoo Han 2 participants 2 messages Nov 25, 2013 – Nov 27, 2013 Memory technology devices (MTD)

lore
Share & tools
lore

Jingoo Han

author
#0 lore raw

PATCH 1/1 mtd: dataflash: remove unnecessary spi_set_drvdata()

The driver core clears the driver data to NULL after device_release or on probe failure. Thus, it is not needed to manually clear the device driver data to NULL.

---
 drivers/mtd/devices/mtd_dataflash.c |    5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/mtd/devices/mtd_dataflash.c +1 -4
index 4a47b02..624069d 100644
@@ -669,7 +669,6 @@ static int add_dataflash_otp(struct spi_device *spi, char *name, int nr_pages,
 	if (!err)
 		return 0;
 
-	spi_set_drvdata(spi, NULL);
 	kfree(priv);
 	return err;
 }
@@ -899,10 +898,8 @@ static int dataflash_remove(struct spi_device *spi)
 	pr_debug("%s: remove\n", dev_name(&spi->dev));
 
 	status = mtd_device_unregister(&flash->mtd);
-	if (status == 0) {
-		spi_set_drvdata(spi, NULL);
+	if (status == 0)
 		kfree(flash);
-	}
 	return status;
 }
 
Signature · 1 line
1.7.10.4
Applied
#1 lore raw
Quoted 5 lines · Jingoo Han

The driver core clears the driver data to NULL after device_release or on probe failure. Thus, it is not needed to manually clear the device driver data to NULL.

Pushed to l2-mtd.git. Thanks!

Brian