From 3ef25dc49d4bf64ca919a9ef7564c8e1f92647ed Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Thu, 17 Mar 2016 09:55:10 -0600 Subject: [PATCH] AT24xx: Add logic to unregister from the procfs file system if the driver is uninitialized --- drivers/mtd/at24xx.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/mtd/at24xx.c b/drivers/mtd/at24xx.c index ee324be4dff..76d2cf26593 100644 --- a/drivers/mtd/at24xx.c +++ b/drivers/mtd/at24xx.c @@ -687,6 +687,15 @@ void at24c_uninitialize(FAR struct mtd_dev_s *mtd) { FAR struct at24c_dev_s *priv = (FAR struct at24c_dev_s *)mtd; DEBUGASSERT(priv != NULL); + +#ifdef CONFIG_MTD_REGISTRATION + /* Unregister the MTD with the procfs system if enabled */ + + mtd_unregister(&priv->mtd); +#endif + + /* Free the MTD driver instance */ + kmm_free(priv); } #endif /* CONFIG_AT24XX_MULTI */