From d86196e5282069b4125b8cf1f9db0167517180f1 Mon Sep 17 00:00:00 2001 From: "sc943313837@gmail.com" Date: Mon, 26 Nov 2012 03:39:00 +0000 Subject: [PATCH] output log when no disk git-svn-id: https://rt-thread.googlecode.com/svn/trunk@2450 bbd45198-f89e-11dd-88c7-29a3b14d5316 --- components/drivers/usb/usbdevice/class/mstorage.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/components/drivers/usb/usbdevice/class/mstorage.c b/components/drivers/usb/usbdevice/class/mstorage.c index 58870dbd86..5d9242f964 100644 --- a/components/drivers/usb/usbdevice/class/mstorage.c +++ b/components/drivers/usb/usbdevice/class/mstorage.c @@ -487,13 +487,16 @@ static rt_err_t _class_run(udevice_t device) disk = rt_device_find(RT_USB_MSTORAGE_DISK_NAME); if(disk == RT_NULL) - return RT_ERROR; + { + rt_kprintf("no disk named %s\n", RT_USB_MSTORAGE_DISK_NAME); + return -RT_ERROR; + } if(rt_device_control(disk, RT_DEVICE_CTRL_BLK_GETGEOME, (void*)&geometry) != RT_EOK) - return RT_ERROR; + return -RT_ERROR; buffer = (rt_uint8_t*)rt_malloc(geometry.bytes_per_sector); if(buffer == RT_NULL) - return RT_ERROR; + return -RT_ENOMEM; dcd_ep_read(device->dcd, ep_out, ep_out->buffer, SIZEOF_CBW); return RT_EOK;