AT24xx: Add logic to unregister from the procfs file system if the driver is uninitialized

This commit is contained in:
Gregory Nutt 2016-03-17 09:55:10 -06:00
parent 78e053565b
commit 3ef25dc49d

View File

@ -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 */