diff options
| author | Bernard Xiong <[email protected]> | 2014-10-14 23:24:02 +0800 |
|---|---|---|
| committer | Bernard Xiong <[email protected]> | 2014-10-14 23:24:02 +0800 |
| commit | 2fc3db65799a126c5c1abdac7f732d2386f09170 (patch) | |
| tree | 401c6dc01b37ba77e9d60fbd23ca8a2fe46a6f51 | |
| parent | a4bb77d09740df6838fcf5a818da3ad0975a4293 (diff) | |
| parent | e03045122053ab8bc1422e03ae723db9ac7ffa98 (diff) | |
Merge pull request #353 from grissiom/misc-fix
Misc fix
| -rw-r--r-- | components/dfs/src/dfs_file.c | 3 | ||||
| -rw-r--r-- | components/finsh/msh.c | 3 | ||||
| -rw-r--r-- | components/finsh/msh_cmd.c | 2 | ||||
| -rw-r--r-- | components/libc/minilibc/stdlib.c | 2 | ||||
| -rw-r--r-- | src/timer.c | 2 |
5 files changed, 11 insertions, 1 deletions
diff --git a/components/dfs/src/dfs_file.c b/components/dfs/src/dfs_file.c index f5619e2354..614a349494 100644 --- a/components/dfs/src/dfs_file.c +++ b/components/dfs/src/dfs_file.c @@ -335,6 +335,9 @@ int dfs_file_lseek(struct dfs_fd *fd, rt_off_t offset) if (fd == RT_NULL) return -DFS_STATUS_EINVAL; + fs = fd->fs; + if (fs == RT_NULL) + return -DFS_STATUS_EINVAL; if (fs->ops->lseek == RT_NULL) return -DFS_STATUS_ENOSYS; diff --git a/components/finsh/msh.c b/components/finsh/msh.c index a976705857..02cbeea196 100644 --- a/components/finsh/msh.c +++ b/components/finsh/msh.c @@ -358,6 +358,9 @@ void msh_auto_complete_path(char *path) struct dirent *dirent = RT_NULL; char *full_path, *ptr, *index; + if (!path) + return; + full_path = (char*)rt_malloc(256); if (full_path == RT_NULL) return; /* out of memory */ diff --git a/components/finsh/msh_cmd.c b/components/finsh/msh_cmd.c index 0ec0b07621..ca92ef7a6d 100644 --- a/components/finsh/msh_cmd.c +++ b/components/finsh/msh_cmd.c @@ -276,6 +276,7 @@ int cmd_time(int argc, char** argv) } FINSH_FUNCTION_EXPORT_ALIAS(cmd_time, __cmd_time, Execute command with time.); +#ifdef RT_USING_HEAP int cmd_free(int argc, char** argv) { extern void list_mem(void); @@ -284,6 +285,7 @@ int cmd_free(int argc, char** argv) return 0; } FINSH_FUNCTION_EXPORT_ALIAS(cmd_free, __cmd_free, Show the memory usage in the system.); +#endif #endif diff --git a/components/libc/minilibc/stdlib.c b/components/libc/minilibc/stdlib.c index 51cb07fee0..e29ae9bc2e 100644 --- a/components/libc/minilibc/stdlib.c +++ b/components/libc/minilibc/stdlib.c @@ -54,6 +54,7 @@ long int atol(const char* s) return sign?-v:v; } +#ifdef RT_USING_HEAP void *malloc(size_t size) { return rt_malloc(size); @@ -73,5 +74,6 @@ void *calloc(size_t nelem, size_t elsize) { return rt_calloc(nelem, elsize); } +#endif #endif diff --git a/src/timer.c b/src/timer.c index f71e40fcd6..ba2801530d 100644 --- a/src/timer.c +++ b/src/timer.c @@ -293,7 +293,7 @@ RTM_EXPORT(rt_timer_delete); */ rt_err_t rt_timer_start(rt_timer_t timer) { - int row_lvl; + unsigned int row_lvl; rt_list_t *timer_list; register rt_base_t level; rt_list_t *row_head[RT_TIMER_SKIP_LIST_LEVEL]; |
