Skip to content

Commit 1fdb548

Browse files
committed
[update] fix finsh bug
1 parent 75a7cb6 commit 1fdb548

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

components/finsh/shell.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -157,17 +157,15 @@ int finsh_getchar(void)
157157
return -1; /* EOF */
158158
}
159159
#else
160-
rt_device_t device;
161160

162161
RT_ASSERT(shell != RT_NULL);
163162

164-
device = shell->device;
165-
if (device == RT_NULL)
163+
if (shell->device == RT_NULL)
166164
{
167165
return -1; /* EOF */
168166
}
169167

170-
while (rt_device_read(device, -1, &ch, 1) != 1)
168+
while (rt_device_read(shell->device, -1, &ch, 1) != 1)
171169
rt_sem_take(&shell->rx_sem, RT_WAITING_FOREVER);
172170

173171
return ch;

0 commit comments

Comments
 (0)