修复无法重复使用finsh命令device_test进行驱动测试

1. 该问题是打开设备后, 出错或者成功后没有关闭设备而导致.
This commit is contained in:
liu2guang 2017-10-02 23:30:46 +08:00
parent 44e3a56d91
commit d47dd9a12c
1 changed files with 4 additions and 1 deletions

View File

@ -449,11 +449,13 @@ static rt_err_t _block_device_test(rt_device_t device)
} }
} /* step 5: multiple sector speed test */ } /* step 5: multiple sector speed test */
rt_device_close(device);
return RT_EOK; return RT_EOK;
}// device can read and write. }// device can read and write.
else else
{ {
// device read only // device read only
rt_device_close(device);
return RT_EOK; return RT_EOK;
}// device read only }// device read only
@ -466,6 +468,7 @@ __return:
{ {
rt_free(write_buffer); rt_free(write_buffer);
} }
rt_device_close(device);
return RT_ERROR; return RT_ERROR;
} }