You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by gu...@apache.org on 2023/01/31 14:50:36 UTC

[nuttx] branch master updated: fs: Add model field to geometry and mtd_geometry_s

This is an automated email from the ASF dual-hosted git repository.

gustavonihei pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git


The following commit(s) were added to refs/heads/master by this push:
     new 9f027208d4 fs: Add model field to geometry and mtd_geometry_s
9f027208d4 is described below

commit 9f027208d450fe822352b5a827dc3c608a4b210c
Author: Xiang Xiao <xi...@xiaomi.com>
AuthorDate: Wed Aug 11 12:21:39 2021 +0800

    fs: Add model field to geometry and mtd_geometry_s
    
    the model is very useful to track the device info
    
    Signed-off-by: Xiang Xiao <xi...@xiaomi.com>
---
 arch/arm/src/cxd56xx/cxd56_emmc.c                      | 2 ++
 arch/arm/src/cxd56xx/cxd56_sfc.c                       | 2 ++
 arch/arm/src/lc823450/lc823450_mmcl.c                  | 3 +++
 arch/arm/src/lc823450/lc823450_mtd.c                   | 2 ++
 arch/arm/src/lpc43xx/lpc43_spifi.c                     | 2 ++
 arch/arm/src/phy62xx/pplus_mtd_flash.c                 | 2 ++
 arch/arm/src/rp2040/rp2040_flash_mtd.c                 | 2 ++
 arch/arm/src/rtl8720c/ameba_flash.c                    | 2 ++
 arch/arm/src/s32k1xx/s32k1xx_eeeprom.c                 | 3 +++
 arch/arm/src/tiva/common/tiva_flash.c                  | 2 ++
 arch/arm/src/tlsr82/tlsr82_flash_mtd.c                 | 2 ++
 arch/risc-v/src/bl602/bl602_spiflash.c                 | 2 ++
 arch/risc-v/src/esp32c3/esp32c3_spiflash_mtd.c         | 2 ++
 arch/xtensa/src/esp32/esp32_spiflash.c                 | 4 ++++
 arch/xtensa/src/esp32s3/esp32s3_spiflash_mtd.c         | 2 ++
 boards/arm/imxrt/imxrt1064-evk/src/imxrt_flexspi_nor.c | 2 ++
 drivers/loop/losetup.c                                 | 3 +++
 drivers/misc/ramdisk.c                                 | 3 +++
 drivers/mmcsd/mmcsd_sdio.c                             | 2 ++
 drivers/mmcsd/mmcsd_spi.c                              | 2 ++
 drivers/mtd/at24xx.c                                   | 2 ++
 drivers/mtd/at25.c                                     | 2 ++
 drivers/mtd/at45db.c                                   | 2 ++
 drivers/mtd/filemtd.c                                  | 2 ++
 drivers/mtd/ftl.c                                      | 2 ++
 drivers/mtd/gd25.c                                     | 2 ++
 drivers/mtd/gd5f.c                                     | 2 ++
 drivers/mtd/is25xp.c                                   | 2 ++
 drivers/mtd/m25px.c                                    | 2 ++
 drivers/mtd/mtd_nand.c                                 | 2 ++
 drivers/mtd/mtd_partition.c                            | 2 ++
 drivers/mtd/mtd_progmem.c                              | 2 ++
 drivers/mtd/mtd_rwbuffer.c                             | 2 ++
 drivers/mtd/mx25lx.c                                   | 2 ++
 drivers/mtd/mx25rxx.c                                  | 2 ++
 drivers/mtd/mx35.c                                     | 2 ++
 drivers/mtd/n25qxxx.c                                  | 2 ++
 drivers/mtd/nullmtd.c                                  | 2 ++
 drivers/mtd/rammtd.c                                   | 2 ++
 drivers/mtd/ramtron.c                                  | 2 ++
 drivers/mtd/s25fl1.c                                   | 2 ++
 drivers/mtd/sector512.c                                | 2 ++
 drivers/mtd/skeleton.c                                 | 2 ++
 drivers/mtd/smart.c                                    | 2 ++
 drivers/mtd/sst25.c                                    | 2 ++
 drivers/mtd/sst25xx.c                                  | 2 ++
 drivers/mtd/sst26.c                                    | 2 ++
 drivers/mtd/sst39vf.c                                  | 2 ++
 drivers/mtd/w25.c                                      | 2 ++
 drivers/mtd/w25qxxxjv.c                                | 2 ++
 drivers/usbhost/usbhost_storage.c                      | 2 ++
 include/nuttx/fs/fs.h                                  | 4 ++++
 include/nuttx/mtd/mtd.h                                | 4 ++++
 53 files changed, 116 insertions(+)

diff --git a/arch/arm/src/cxd56xx/cxd56_emmc.c b/arch/arm/src/cxd56xx/cxd56_emmc.c
index 174e079c21..c9b256389b 100644
--- a/arch/arm/src/cxd56xx/cxd56_emmc.c
+++ b/arch/arm/src/cxd56xx/cxd56_emmc.c
@@ -920,6 +920,8 @@ static int cxd56_emmc_geometry(struct inode *inode,
   DEBUGASSERT(inode && inode->i_private);
   priv = (struct cxd56_emmc_state_s *)inode->i_private;
 
+  memset(geometry, 0, sizeof(*geometry));
+
   geometry->geo_available = true;
   geometry->geo_mediachanged = false;
 #if !defined(CONFIG_MMCSD_READONLY)
diff --git a/arch/arm/src/cxd56xx/cxd56_sfc.c b/arch/arm/src/cxd56xx/cxd56_sfc.c
index 1c5f4a1860..5321448b97 100644
--- a/arch/arm/src/cxd56xx/cxd56_sfc.c
+++ b/arch/arm/src/cxd56xx/cxd56_sfc.c
@@ -190,6 +190,8 @@ static int cxd56_ioctl(struct mtd_dev_s *dev, int cmd, unsigned long arg)
           finfo("cmd: GEOM\n");
           if (geo)
             {
+              memset(geo, 0, sizeof(*geo));
+
               /* Populate the geometry structure with information need to
                * know the capacity and how to access the device.
                *
diff --git a/arch/arm/src/lc823450/lc823450_mmcl.c b/arch/arm/src/lc823450/lc823450_mmcl.c
index 9376251577..9295816b0c 100644
--- a/arch/arm/src/lc823450/lc823450_mmcl.c
+++ b/arch/arm/src/lc823450/lc823450_mmcl.c
@@ -192,6 +192,9 @@ static int mmcl_geometry(struct inode *inode, struct geometry *geometry)
   if (geometry)
     {
       dev = (struct mmcl_dev_s *)inode->i_private;
+
+      memset(geometry, 0, sizeof(*geometry));
+
       geometry->geo_available     = true;
       geometry->geo_mediachanged  = false;
       geometry->geo_writeenabled  = true;
diff --git a/arch/arm/src/lc823450/lc823450_mtd.c b/arch/arm/src/lc823450/lc823450_mtd.c
index 8d9f20c11b..a33ccae0d0 100644
--- a/arch/arm/src/lc823450/lc823450_mtd.c
+++ b/arch/arm/src/lc823450/lc823450_mtd.c
@@ -314,6 +314,8 @@ static int lc823450_ioctl(struct mtd_dev_s *dev, int cmd,
         geo = (struct mtd_geometry_s *)arg;
         if (geo)
           {
+            memset(geo, 0, sizeof(*geo));
+
             /* Populate the geometry structure with information needed to
              * know the capacity and how to access the device.
              */
diff --git a/arch/arm/src/lpc43xx/lpc43_spifi.c b/arch/arm/src/lpc43xx/lpc43_spifi.c
index 20f51b1a60..17ee681b68 100644
--- a/arch/arm/src/lpc43xx/lpc43_spifi.c
+++ b/arch/arm/src/lpc43xx/lpc43_spifi.c
@@ -858,6 +858,8 @@ static int lpc43_ioctl(struct mtd_dev_s *dev, int cmd, unsigned long arg)
                              (struct mtd_geometry_s *)((uintptr_t)arg);
           if (geo)
             {
+               memset(geo, 0, sizeof(*geo));
+
               /* Populate the geometry structure with information need to
                * know the capacity and how to access the device.
                *
diff --git a/arch/arm/src/phy62xx/pplus_mtd_flash.c b/arch/arm/src/phy62xx/pplus_mtd_flash.c
index adfb56f16e..ebfe9472b4 100644
--- a/arch/arm/src/phy62xx/pplus_mtd_flash.c
+++ b/arch/arm/src/phy62xx/pplus_mtd_flash.c
@@ -288,6 +288,8 @@ static int pplus_fls_ioctl(struct mtd_dev_s *dev,
 
           if (geo)
             {
+              memset(geo, 0, sizeof(*geo));
+
               /* Populate the geometry structure with information need to
                * know the capacity and how to access the device.
                *
diff --git a/arch/arm/src/rp2040/rp2040_flash_mtd.c b/arch/arm/src/rp2040/rp2040_flash_mtd.c
index 3d5a6d32d4..d99e8879b8 100644
--- a/arch/arm/src/rp2040/rp2040_flash_mtd.c
+++ b/arch/arm/src/rp2040/rp2040_flash_mtd.c
@@ -456,6 +456,8 @@ static int rp2040_flash_ioctl(struct mtd_dev_s *dev,
 
           if (geo != NULL)
             {
+              memset(geo, 0, sizeof(*geo));
+
               geo->blocksize    = FLASH_SECTOR_SIZE;
               geo->erasesize    = FLASH_BLOCK_SIZE;
               geo->neraseblocks = FLASH_BLOCK_COUNT;
diff --git a/arch/arm/src/rtl8720c/ameba_flash.c b/arch/arm/src/rtl8720c/ameba_flash.c
index 00ec170f40..5dbf3796ca 100644
--- a/arch/arm/src/rtl8720c/ameba_flash.c
+++ b/arch/arm/src/rtl8720c/ameba_flash.c
@@ -236,6 +236,8 @@ static int ameba_flash_ioctl(struct mtd_dev_s *dev,
         (struct mtd_geometry_s *)((uintptr_t)arg);
       if (geo)
         {
+          memset(geo, 0, sizeof(*geo));
+
           geo->blocksize    = AMEBA_PAGE_SIZE;
           geo->erasesize    = AMEBA_SECTOR_SIZE;
           geo->neraseblocks = priv->nsectors;
diff --git a/arch/arm/src/s32k1xx/s32k1xx_eeeprom.c b/arch/arm/src/s32k1xx/s32k1xx_eeeprom.c
index 236761eed3..ad67f62cbe 100644
--- a/arch/arm/src/s32k1xx/s32k1xx_eeeprom.c
+++ b/arch/arm/src/s32k1xx/s32k1xx_eeeprom.c
@@ -292,6 +292,9 @@ static int eeed_geometry(struct inode *inode, struct geometry *geometry)
   if (geometry)
     {
       dev = (struct eeed_struct_s *)inode->i_private;
+
+      memset(geometry, 0, sizeof(*geometry));
+
       geometry->geo_available     = true;
       geometry->geo_mediachanged  = false;
       geometry->geo_writeenabled  = true;
diff --git a/arch/arm/src/tiva/common/tiva_flash.c b/arch/arm/src/tiva/common/tiva_flash.c
index e314be1723..ddc732cfa5 100644
--- a/arch/arm/src/tiva/common/tiva_flash.c
+++ b/arch/arm/src/tiva/common/tiva_flash.c
@@ -377,6 +377,8 @@ static int tiva_ioctl(struct mtd_dev_s *dev, int cmd, unsigned long arg)
           struct mtd_geometry_s *geo = (struct mtd_geometry_s *)arg;
           if (geo)
             {
+              memset(geo, 0, sizeof(*geo));
+
               /* Populate the geometry structure with information needed to
                * know the capacity and how to access the device.
                *
diff --git a/arch/arm/src/tlsr82/tlsr82_flash_mtd.c b/arch/arm/src/tlsr82/tlsr82_flash_mtd.c
index 56dae50127..9c8ced3a46 100644
--- a/arch/arm/src/tlsr82/tlsr82_flash_mtd.c
+++ b/arch/arm/src/tlsr82/tlsr82_flash_mtd.c
@@ -782,6 +782,8 @@ static int tlsr82_flash_ioctl(struct mtd_dev_s *dev, int cmd,
 
           if (geo)
             {
+              memset(geo, 0, sizeof(*geo));
+
               /* Populate the geometry structure with information need to
                * know the capacity and how to access the device.
                *
diff --git a/arch/risc-v/src/bl602/bl602_spiflash.c b/arch/risc-v/src/bl602/bl602_spiflash.c
index c651a15d6a..732f94fe1f 100644
--- a/arch/risc-v/src/bl602/bl602_spiflash.c
+++ b/arch/risc-v/src/bl602/bl602_spiflash.c
@@ -296,6 +296,8 @@ int bl602_ioctl(struct mtd_dev_s *dev, int cmd,
           struct mtd_geometry_s *geo = (struct mtd_geometry_s *)arg;
           if (geo)
             {
+              memset(geo, 0, sizeof(*geo));
+
               geo->blocksize    = SPIFLASH_BLOCKSIZE;
               geo->erasesize    = SPIFLASH_BLOCKSIZE;
               geo->neraseblocks = (priv->config->flash_size) / \
diff --git a/arch/risc-v/src/esp32c3/esp32c3_spiflash_mtd.c b/arch/risc-v/src/esp32c3/esp32c3_spiflash_mtd.c
index 02ac929a15..83c46b391a 100644
--- a/arch/risc-v/src/esp32c3/esp32c3_spiflash_mtd.c
+++ b/arch/risc-v/src/esp32c3/esp32c3_spiflash_mtd.c
@@ -577,6 +577,8 @@ static int esp32c3_ioctl(struct mtd_dev_s *dev, int cmd,
           struct mtd_geometry_s *geo = (struct mtd_geometry_s *)arg;
           if (geo)
             {
+              memset(geo, 0, sizeof(*geo));
+
               geo->blocksize    = MTD_BLK_SIZE;
               geo->erasesize    = MTD_ERASE_SIZE;
               geo->neraseblocks = MTD_SIZE(priv) / MTD_ERASE_SIZE;
diff --git a/arch/xtensa/src/esp32/esp32_spiflash.c b/arch/xtensa/src/esp32/esp32_spiflash.c
index 477c663e0c..a987101c58 100644
--- a/arch/xtensa/src/esp32/esp32_spiflash.c
+++ b/arch/xtensa/src/esp32/esp32_spiflash.c
@@ -1990,6 +1990,8 @@ static int esp32_ioctl(struct mtd_dev_s *dev, int cmd,
           struct mtd_geometry_s *geo = (struct mtd_geometry_s *)arg;
           if (geo)
             {
+              memset(geo, 0, sizeof(*geo));
+
               geo->blocksize    = MTD_BLKSIZE(priv);
               geo->erasesize    = MTD_ERASESIZE(priv);
               geo->neraseblocks = MTD_SIZE(priv) / MTD_ERASESIZE(priv);
@@ -2066,6 +2068,8 @@ static int esp32_ioctl_encrypt(struct mtd_dev_s *dev, int cmd,
           struct mtd_geometry_s *geo = (struct mtd_geometry_s *)arg;
           if (geo)
             {
+              memset(geo, 0, sizeof(*geo));
+
               geo->blocksize    = SPI_FLASH_ENCRYPT_MIN_SIZE;
               geo->erasesize    = MTD_ERASESIZE(priv);
               geo->neraseblocks = MTD_SIZE(priv) / geo->erasesize;
diff --git a/arch/xtensa/src/esp32s3/esp32s3_spiflash_mtd.c b/arch/xtensa/src/esp32s3/esp32s3_spiflash_mtd.c
index ab7cc6790e..8346ad50f3 100644
--- a/arch/xtensa/src/esp32s3/esp32s3_spiflash_mtd.c
+++ b/arch/xtensa/src/esp32s3/esp32s3_spiflash_mtd.c
@@ -620,6 +620,8 @@ static int esp32s3_ioctl(struct mtd_dev_s *dev, int cmd,
           struct mtd_geometry_s *geo = (struct mtd_geometry_s *)arg;
           if (geo)
             {
+              memset(geo, 0, sizeof(*geo));
+
               geo->blocksize    = MTD_BLK_SIZE;
               geo->erasesize    = MTD_ERASE_SIZE;
               geo->neraseblocks = MTD_SIZE(priv) / MTD_ERASE_SIZE;
diff --git a/boards/arm/imxrt/imxrt1064-evk/src/imxrt_flexspi_nor.c b/boards/arm/imxrt/imxrt1064-evk/src/imxrt_flexspi_nor.c
index 97b3733240..ee086d5d08 100644
--- a/boards/arm/imxrt/imxrt1064-evk/src/imxrt_flexspi_nor.c
+++ b/boards/arm/imxrt/imxrt1064-evk/src/imxrt_flexspi_nor.c
@@ -556,6 +556,8 @@ static int imxrt_flexspi_nor_ioctl(struct mtd_dev_s *dev,
 
           if (geo)
             {
+              memset(geo, 0, sizeof(*geo));
+
               /* Populate the geometry structure with information need to
                * know the capacity and how to access the device.
                *
diff --git a/drivers/loop/losetup.c b/drivers/loop/losetup.c
index d5647e4cb2..6fe2fc4f5b 100644
--- a/drivers/loop/losetup.c
+++ b/drivers/loop/losetup.c
@@ -288,6 +288,9 @@ static int loop_geometry(FAR struct inode *inode,
   if (geometry)
     {
       dev = (FAR struct loop_struct_s *)inode->i_private;
+
+      memset(geometry, 0, sizeof(*geometry));
+
       geometry->geo_available     = true;
       geometry->geo_mediachanged  = false;
       geometry->geo_writeenabled  = dev->writeenabled;
diff --git a/drivers/misc/ramdisk.c b/drivers/misc/ramdisk.c
index 0c85a13329..ab3383e750 100644
--- a/drivers/misc/ramdisk.c
+++ b/drivers/misc/ramdisk.c
@@ -307,6 +307,9 @@ static int rd_geometry(FAR struct inode *inode, struct geometry *geometry)
   if (geometry)
     {
       dev = (struct rd_struct_s *)inode->i_private;
+
+      memset(geometry, 0, sizeof(*geometry));
+
       geometry->geo_available     = true;
       geometry->geo_mediachanged  = false;
       geometry->geo_writeenabled  = RDFLAG_IS_WRENABLED(dev->rd_flags);
diff --git a/drivers/mmcsd/mmcsd_sdio.c b/drivers/mmcsd/mmcsd_sdio.c
index a26c4d4953..4e4f0e22a1 100644
--- a/drivers/mmcsd/mmcsd_sdio.c
+++ b/drivers/mmcsd/mmcsd_sdio.c
@@ -2247,6 +2247,8 @@ static int mmcsd_geometry(FAR struct inode *inode, struct geometry *geometry)
 
   if (geometry)
     {
+      memset(geometry, 0, sizeof(*geometry));
+
       /* Is there a (supported) card inserted in the slot? */
 
       priv = (FAR struct mmcsd_state_s *)inode->i_private;
diff --git a/drivers/mmcsd/mmcsd_spi.c b/drivers/mmcsd/mmcsd_spi.c
index a4466a9977..95c7872ea7 100644
--- a/drivers/mmcsd/mmcsd_spi.c
+++ b/drivers/mmcsd/mmcsd_spi.c
@@ -1611,6 +1611,8 @@ static int mmcsd_geometry(FAR struct inode *inode, struct geometry *geometry)
 
   /* Then return the card geometry */
 
+  memset(geometry, 0, sizeof(*geometry));
+
   geometry->geo_available =
     ((slot->state & (MMCSD_SLOTSTATUS_NOTREADY |
                      MMCSD_SLOTSTATUS_NODISK)) == 0);
diff --git a/drivers/mtd/at24xx.c b/drivers/mtd/at24xx.c
index 2b37cea646..c0a409ccfb 100644
--- a/drivers/mtd/at24xx.c
+++ b/drivers/mtd/at24xx.c
@@ -579,6 +579,8 @@ static int at24c_ioctl(FAR struct mtd_dev_s *dev, int cmd, unsigned long arg)
                                           ((uintptr_t)arg);
           if (geo)
             {
+              memset(geo, 0, sizeof(*geo));
+
               /* Populate the geometry structure with information need to
                * know the capacity and how to access the device.
                *
diff --git a/drivers/mtd/at25.c b/drivers/mtd/at25.c
index 82ea675b42..32b4c288c7 100644
--- a/drivers/mtd/at25.c
+++ b/drivers/mtd/at25.c
@@ -616,6 +616,8 @@ static int at25_ioctl(FAR struct mtd_dev_s *dev, int cmd, unsigned long arg)
 
           if (geo != NULL)
             {
+              memset(geo, 0, sizeof(*geo));
+
               /* Populate the geometry structure with information need to
                * know the capacity and how to access the device.
                *
diff --git a/drivers/mtd/at45db.c b/drivers/mtd/at45db.c
index dade87b6e8..dd4dffa9cf 100644
--- a/drivers/mtd/at45db.c
+++ b/drivers/mtd/at45db.c
@@ -783,6 +783,8 @@ static int at45db_ioctl(FAR struct mtd_dev_s *mtd,
                     (FAR struct mtd_geometry_s *)((uintptr_t)arg);
           if (geo)
             {
+              memset(geo, 0, sizeof(*geo));
+
               /* Populate the geometry structure with information need to
                * know the capacity and how to access the device.
                *
diff --git a/drivers/mtd/filemtd.c b/drivers/mtd/filemtd.c
index ab6f4fbda5..b61f87f4b6 100644
--- a/drivers/mtd/filemtd.c
+++ b/drivers/mtd/filemtd.c
@@ -443,6 +443,8 @@ static int filemtd_ioctl(FAR struct mtd_dev_s *dev, int cmd,
 
           if (geo)
             {
+              memset(geo, 0, sizeof(*geo));
+
               /* Populate the geometry structure with information need to
                * know the capacity and how to access the device.
                */
diff --git a/drivers/mtd/ftl.c b/drivers/mtd/ftl.c
index 0b02393697..33482118e3 100644
--- a/drivers/mtd/ftl.c
+++ b/drivers/mtd/ftl.c
@@ -478,6 +478,8 @@ static int ftl_geometry(FAR struct inode *inode,
       geometry->geo_nsectors      = dev->geo.neraseblocks * dev->blkper;
       geometry->geo_sectorsize    = dev->geo.blocksize;
 
+      strcpy(geometry->geo_model, dev->geo.model);
+
       finfo("available: true mediachanged: false writeenabled: %s\n",
             geometry->geo_writeenabled ? "true" : "false");
       finfo("nsectors: %" PRIuOFF " sectorsize: %u\n",
diff --git a/drivers/mtd/gd25.c b/drivers/mtd/gd25.c
index 2959244a78..79e731df69 100644
--- a/drivers/mtd/gd25.c
+++ b/drivers/mtd/gd25.c
@@ -947,6 +947,8 @@ static int gd25_ioctl(FAR struct mtd_dev_s *dev, int cmd, unsigned long arg)
             (FAR struct mtd_geometry_s *)((uintptr_t)arg);
           if (geo)
             {
+              memset(geo, 0, sizeof(*geo));
+
               geo->blocksize    = GD25_PAGE_SIZE;
               geo->erasesize    = GD25_SECTOR_SIZE;
               geo->neraseblocks = priv->nsectors;
diff --git a/drivers/mtd/gd5f.c b/drivers/mtd/gd5f.c
index 746269b83f..a4bdb1bae1 100644
--- a/drivers/mtd/gd5f.c
+++ b/drivers/mtd/gd5f.c
@@ -753,6 +753,8 @@ static int gd5f_ioctl(FAR struct mtd_dev_s *dev, int cmd, unsigned long arg)
                   (FAR struct mtd_geometry_s *)((uintptr_t)arg);
           if (geo)
             {
+              memset(geo, 0, sizeof(*geo));
+
               geo->blocksize    = (1 << priv->pageshift);
               geo->erasesize    = (1 << priv->sectorshift);
               geo->neraseblocks = priv->nsectors;
diff --git a/drivers/mtd/is25xp.c b/drivers/mtd/is25xp.c
index 6dd1a70d08..66bf75c476 100644
--- a/drivers/mtd/is25xp.c
+++ b/drivers/mtd/is25xp.c
@@ -1010,6 +1010,8 @@ static int is25xp_ioctl(FAR struct mtd_dev_s *dev,
                               (FAR struct mtd_geometry_s *)((uintptr_t)arg);
           if (geo)
             {
+              memset(geo, 0, sizeof(*geo));
+
               /* Populate the geometry structure with information need to
                * know the capacity and how to access the device.
                *
diff --git a/drivers/mtd/m25px.c b/drivers/mtd/m25px.c
index cbe633fe6c..847ef96d0d 100644
--- a/drivers/mtd/m25px.c
+++ b/drivers/mtd/m25px.c
@@ -1056,6 +1056,8 @@ static int m25p_ioctl(FAR struct mtd_dev_s *dev, int cmd, unsigned long arg)
                                            ((uintptr_t)arg);
           if (geo)
             {
+              memset(geo, 0, sizeof(*geo));
+
               /* Populate the geometry structure with information need to
                * know the capacity and how to access the device.
                *
diff --git a/drivers/mtd/mtd_nand.c b/drivers/mtd/mtd_nand.c
index ab856e385c..eabee860a5 100644
--- a/drivers/mtd/mtd_nand.c
+++ b/drivers/mtd/mtd_nand.c
@@ -758,6 +758,8 @@ static int nand_ioctl(struct mtd_dev_s *dev, int cmd, unsigned long arg)
           FAR struct mtd_geometry_s *geo = (struct mtd_geometry_s *)arg;
           if (geo)
             {
+              memset(geo, 0, sizeof(*geo));
+
               /* Populate the geometry structure with information needed to
                * know the capacity and how to access the device.  Returns:
                *
diff --git a/drivers/mtd/mtd_partition.c b/drivers/mtd/mtd_partition.c
index 316745b149..7702413687 100644
--- a/drivers/mtd/mtd_partition.c
+++ b/drivers/mtd/mtd_partition.c
@@ -403,6 +403,8 @@ static int part_ioctl(FAR struct mtd_dev_s *dev, int cmd, unsigned long arg)
           FAR struct mtd_geometry_s *geo = (FAR struct mtd_geometry_s *)arg;
           if (geo)
             {
+              memset(geo, 0, sizeof(*geo));
+
               /* Populate the geometry structure with information needed to
                * know the capacity and how to access the device.
                */
diff --git a/drivers/mtd/mtd_progmem.c b/drivers/mtd/mtd_progmem.c
index 48e18fd361..4773e866de 100644
--- a/drivers/mtd/mtd_progmem.c
+++ b/drivers/mtd/mtd_progmem.c
@@ -310,6 +310,8 @@ static int progmem_ioctl(FAR struct mtd_dev_s *dev, int cmd,
           FAR struct mtd_geometry_s *geo = (FAR struct mtd_geometry_s *)arg;
           if (geo)
             {
+              memset(geo, 0, sizeof(*geo));
+
               /* Populate the geometry structure with information needed to
                * know the capacity and how to access the device.
                *
diff --git a/drivers/mtd/mtd_rwbuffer.c b/drivers/mtd/mtd_rwbuffer.c
index d6fc63b38e..7b76b605ad 100644
--- a/drivers/mtd/mtd_rwbuffer.c
+++ b/drivers/mtd/mtd_rwbuffer.c
@@ -275,6 +275,8 @@ static int mtd_ioctl(FAR struct mtd_dev_s *dev, int cmd, unsigned long arg)
                                            ((uintptr_t)arg);
           if (geo)
             {
+              memset(geo, 0, sizeof(*geo));
+
               /* Populate the geometry structure with information need to
                * know the capacity and how to access the device.
                *
diff --git a/drivers/mtd/mx25lx.c b/drivers/mtd/mx25lx.c
index 9848ebfc80..68257ab421 100644
--- a/drivers/mtd/mx25lx.c
+++ b/drivers/mtd/mx25lx.c
@@ -1053,6 +1053,8 @@ static int mx25l_ioctl(FAR struct mtd_dev_s *dev, int cmd, unsigned long arg)
             (FAR struct mtd_geometry_s *)((uintptr_t)arg);
           if (geo)
             {
+              memset(geo, 0, sizeof(*geo));
+
               /* Populate the geometry structure with information need to
                * know the capacity and how to access the device.
                *
diff --git a/drivers/mtd/mx25rxx.c b/drivers/mtd/mx25rxx.c
index e9d0928cbb..69e445274e 100644
--- a/drivers/mtd/mx25rxx.c
+++ b/drivers/mtd/mx25rxx.c
@@ -735,6 +735,8 @@ int mx25rxx_ioctl(FAR struct mtd_dev_s *dev, int cmd, unsigned long arg)
 
           if (geo)
             {
+              memset(geo, 0, sizeof(*geo));
+
               /* Populate the geometry structure with information need to
                * know the capacity and how to access the device.
                *
diff --git a/drivers/mtd/mx35.c b/drivers/mtd/mx35.c
index 640a9aacc1..992d5aef01 100644
--- a/drivers/mtd/mx35.c
+++ b/drivers/mtd/mx35.c
@@ -789,6 +789,8 @@ static int mx35_ioctl(FAR struct mtd_dev_s *dev, int cmd, unsigned long arg)
                   (FAR struct mtd_geometry_s *)((uintptr_t)arg);
           if (geo)
             {
+              memset(geo, 0, sizeof(*geo));
+
               /* Populate the geometry structure with information need to
                * know the capacity and how to access the device.
                *
diff --git a/drivers/mtd/n25qxxx.c b/drivers/mtd/n25qxxx.c
index ae26637e98..09cfeec753 100644
--- a/drivers/mtd/n25qxxx.c
+++ b/drivers/mtd/n25qxxx.c
@@ -1371,6 +1371,8 @@ static int n25qxxx_ioctl(FAR struct mtd_dev_s *dev,
 
           if (geo)
             {
+              memset(geo, 0, sizeof(*geo));
+
               /* Populate the geometry structure with information need to
                * know the capacity and how to access the device.
                *
diff --git a/drivers/mtd/nullmtd.c b/drivers/mtd/nullmtd.c
index e8547e9070..633e0aedfe 100644
--- a/drivers/mtd/nullmtd.c
+++ b/drivers/mtd/nullmtd.c
@@ -276,6 +276,8 @@ static int nullmtd_ioctl(FAR struct mtd_dev_s *dev, int cmd,
 
           if (geo)
             {
+              memset(geo, 0, sizeof(*geo));
+
               /* Populate the geometry structure with information need to
                * know the capacity and how to access the device.
                */
diff --git a/drivers/mtd/rammtd.c b/drivers/mtd/rammtd.c
index 0088a51947..749d1a4ca2 100644
--- a/drivers/mtd/rammtd.c
+++ b/drivers/mtd/rammtd.c
@@ -386,6 +386,8 @@ static int ram_ioctl(FAR struct mtd_dev_s *dev, int cmd, unsigned long arg)
                               (FAR struct mtd_geometry_s *)((uintptr_t)arg);
           if (geo)
             {
+              memset(geo, 0, sizeof(*geo));
+
               /* Populate the geometry structure with information need to
                * know the capacity and how to access the device.
                */
diff --git a/drivers/mtd/ramtron.c b/drivers/mtd/ramtron.c
index fbdff6245d..504328dc7d 100644
--- a/drivers/mtd/ramtron.c
+++ b/drivers/mtd/ramtron.c
@@ -838,6 +838,8 @@ static int ramtron_ioctl(FAR struct mtd_dev_s *dev,
                     (FAR struct mtd_geometry_s *)((uintptr_t)arg);
           if (geo)
             {
+              memset(geo, 0, sizeof(*geo));
+
               /* Populate the geometry structure with information need to
                * know the capacity and how to access the device.
                *
diff --git a/drivers/mtd/s25fl1.c b/drivers/mtd/s25fl1.c
index ebd28c1f63..c92b39f945 100644
--- a/drivers/mtd/s25fl1.c
+++ b/drivers/mtd/s25fl1.c
@@ -1419,6 +1419,8 @@ static int s25fl1_ioctl(FAR struct mtd_dev_s *dev,
 
           if (geo)
             {
+              memset(geo, 0, sizeof(*geo));
+
               /* Populate the geometry structure with information need to
                * know the capacity and how to access the device.
                *
diff --git a/drivers/mtd/sector512.c b/drivers/mtd/sector512.c
index 16b720ae1b..6aad159a10 100644
--- a/drivers/mtd/sector512.c
+++ b/drivers/mtd/sector512.c
@@ -521,6 +521,8 @@ static int s512_ioctl(FAR struct mtd_dev_s *dev, int cmd, unsigned long arg)
                                            ((uintptr_t)arg);
           if (geo)
             {
+              memset(geo, 0, sizeof(*geo));
+
               /* Populate the geometry structure with information need to
                * know the capacity and how to access the device.
                *
diff --git a/drivers/mtd/skeleton.c b/drivers/mtd/skeleton.c
index 2597100319..1a2d42ec24 100644
--- a/drivers/mtd/skeleton.c
+++ b/drivers/mtd/skeleton.c
@@ -241,6 +241,8 @@ static int skel_ioctl(FAR struct mtd_dev_s *dev, int cmd, unsigned long arg)
           FAR struct mtd_geometry_s *geo = (FAR struct mtd_geometry_s *)arg;
           if (geo)
             {
+              memset(geo, 0, sizeof(*geo));
+
               /* Populate the geometry structure with information needed to
                * know the capacity and how to access the device.
                *
diff --git a/drivers/mtd/smart.c b/drivers/mtd/smart.c
index d0ca3fca09..bc7220a182 100644
--- a/drivers/mtd/smart.c
+++ b/drivers/mtd/smart.c
@@ -1066,6 +1066,8 @@ static int smart_geometry(FAR struct inode *inode, struct geometry *geometry)
                                     dev->sectorsize;
       geometry->geo_sectorsize    = dev->sectorsize;
 
+      strcpy(geometry->geo_model, dev->geo.model);
+
       finfo("available: true mediachanged: false writeenabled: %s\n",
             geometry->geo_writeenabled ? "true" : "false");
       finfo("nsectors: %" PRIuOFF " sectorsize: %" PRIi16 "\n",
diff --git a/drivers/mtd/sst25.c b/drivers/mtd/sst25.c
index 8128073035..c114bc4ba5 100644
--- a/drivers/mtd/sst25.c
+++ b/drivers/mtd/sst25.c
@@ -1167,6 +1167,8 @@ static int sst25_ioctl(FAR struct mtd_dev_s *dev, int cmd, unsigned long arg)
                                            ((uintptr_t)arg);
           if (geo)
             {
+              memset(geo, 0, sizeof(*geo));
+
               /* Populate the geometry structure with information need to
                * know the capacity and how to access the device.
                *
diff --git a/drivers/mtd/sst25xx.c b/drivers/mtd/sst25xx.c
index 31892e80b2..39dca0d789 100644
--- a/drivers/mtd/sst25xx.c
+++ b/drivers/mtd/sst25xx.c
@@ -871,6 +871,8 @@ static int sst25xx_ioctl(FAR struct mtd_dev_s *dev, int cmd,
                                            ((uintptr_t)arg);
           if (geo)
             {
+              memset(geo, 0, sizeof(*geo));
+
               /* Populate the geometry structure with information need to
                * know the capacity and how to access the device.
                *
diff --git a/drivers/mtd/sst26.c b/drivers/mtd/sst26.c
index 200b225f17..18a59a23cc 100644
--- a/drivers/mtd/sst26.c
+++ b/drivers/mtd/sst26.c
@@ -877,6 +877,8 @@ static int sst26_ioctl(FAR struct mtd_dev_s *dev, int cmd, unsigned long arg)
             (FAR struct mtd_geometry_s *)((uintptr_t)arg);
           if (geo != NULL)
             {
+              memset(geo, 0, sizeof(*geo));
+
               /* Populate the geometry structure with information need to
                * know  the capacity and how to access the device.
                *
diff --git a/drivers/mtd/sst39vf.c b/drivers/mtd/sst39vf.c
index 27ff74ec1d..9f97b28663 100644
--- a/drivers/mtd/sst39vf.c
+++ b/drivers/mtd/sst39vf.c
@@ -710,6 +710,8 @@ static int sst39vf_ioctl(FAR struct mtd_dev_s *dev,
           FAR struct mtd_geometry_s *geo = (FAR struct mtd_geometry_s *)arg;
           if (geo)
             {
+              memset(geo, 0, sizeof(*geo));
+
               /* Populate the geometry structure with information need to
                * know the capacity and how to access the device.
                */
diff --git a/drivers/mtd/w25.c b/drivers/mtd/w25.c
index 8ad56e0b3d..4288ecd075 100644
--- a/drivers/mtd/w25.c
+++ b/drivers/mtd/w25.c
@@ -1294,6 +1294,8 @@ static int w25_ioctl(FAR struct mtd_dev_s *dev, int cmd, unsigned long arg)
             (FAR struct mtd_geometry_s *)((uintptr_t)arg);
           if (geo)
             {
+              memset(geo, 0, sizeof(*geo));
+
               /* Populate the geometry structure with information need to
                * know the capacity and how to access the device.
                *
diff --git a/drivers/mtd/w25qxxxjv.c b/drivers/mtd/w25qxxxjv.c
index ad331edcd7..013704b6f6 100644
--- a/drivers/mtd/w25qxxxjv.c
+++ b/drivers/mtd/w25qxxxjv.c
@@ -1409,6 +1409,8 @@ static int w25qxxxjv_ioctl(FAR struct mtd_dev_s *dev,
 
           if (geo)
             {
+              memset(geo, 0, sizeof(*geo));
+
               /* Populate the geometry structure with information need to
                * know the capacity and how to access the device.
                *
diff --git a/drivers/usbhost/usbhost_storage.c b/drivers/usbhost/usbhost_storage.c
index 0c516810a2..e5fe3b1696 100644
--- a/drivers/usbhost/usbhost_storage.c
+++ b/drivers/usbhost/usbhost_storage.c
@@ -2220,6 +2220,8 @@ static int usbhost_geometry(FAR struct inode *inode,
       ret = nxmutex_lock(&priv->lock);
       if (ret >= 0)
         {
+          memset(geometry, 0, sizeof(*geometry));
+
           geometry->geo_available     = true;
           geometry->geo_mediachanged  = false;
           geometry->geo_writeenabled  = true;
diff --git a/include/nuttx/fs/fs.h b/include/nuttx/fs/fs.h
index cdc1125eb7..51e01c1efc 100644
--- a/include/nuttx/fs/fs.h
+++ b/include/nuttx/fs/fs.h
@@ -237,6 +237,10 @@ struct geometry
   bool      geo_writeenabled; /* true: It is okay to write to this device */
   blkcnt_t  geo_nsectors;     /* Number of sectors on the device */
   blksize_t geo_sectorsize;   /* Size of one sector */
+
+  /* NULL-terminated string representing the device model */
+
+  char      geo_model[NAME_MAX + 1];
 };
 
 struct partition_info_s
diff --git a/include/nuttx/mtd/mtd.h b/include/nuttx/mtd/mtd.h
index a029b9a4b0..721b4ec2d9 100644
--- a/include/nuttx/mtd/mtd.h
+++ b/include/nuttx/mtd/mtd.h
@@ -110,6 +110,10 @@ struct mtd_geometry_s
   uint32_t erasesize;     /* Size of one erase blocks -- must be a multiple
                            * of blocksize. */
   uint32_t neraseblocks;  /* Number of erase blocks */
+
+  /* NULL-terminated string representing the device model */
+
+  char     model[NAME_MAX + 1];
 };
 
 /* This structure describes a range of sectors to be protected or