Browse Source

[DeviceDrivers]Make sure rt_sfud_flash_probe device must be SPI device.

armink 8 years ago
parent
commit
270285217d
1 changed files with 1 additions and 1 deletions
  1. 1 1
      components/drivers/spi/spi_flash_sfud.c

+ 1 - 1
components/drivers/spi/spi_flash_sfud.c

@@ -264,7 +264,7 @@ rt_spi_flash_device_t rt_sfud_flash_probe(const char *spi_flash_dev_name, const
         {
         {
             /* RT-Thread SPI device initialize */
             /* RT-Thread SPI device initialize */
             rtt_dev->rt_spi_device = (struct rt_spi_device *) rt_device_find(spi_dev_name);
             rtt_dev->rt_spi_device = (struct rt_spi_device *) rt_device_find(spi_dev_name);
-            if (rtt_dev->rt_spi_device == RT_NULL) {
+            if (rtt_dev->rt_spi_device == RT_NULL || rtt_dev->rt_spi_device->parent.type != RT_Device_Class_SPIDevice) {
                 rt_kprintf("ERROR: SPI device %s not found!\n", spi_dev_name);
                 rt_kprintf("ERROR: SPI device %s not found!\n", spi_dev_name);
                 goto error;
                 goto error;
             }
             }