drivers: modem: modem_cmd_handler.c: Drop cmd from buf if args are missing
In 90c6dc5e, a change was introduced to allow modem commands determine if they have enough data or not. In a situation where some data is missing, the command should return -EAGAIN and this should lead to another call of the command with more data. In this commit, the argument parser was also allowed to return -EAGAIN to request more data due to missing arguments. However, this can't work because in cmd_handler_process_rx_buf() before calling process_cmd(): - we make sure that a CR/LF has been found. - we compute match_len which can't be greater than the distance to the next CR/LF. Therefore, even if the command argument parser ask for more data by returning -EAGAIN, next call will have the same value for match_len, meaning that the parsing of argument will result in the same missing argument situation. This leads to an infinite loop of parsing the same data over and over in an infinite loop. This commit change this behavior to always drop the data in such a situation. The command will not be answered and will therefore timeout, but at least, next commands will correctly parse their returned data. Signed-off-by:Xavier Chapron <xavier.chapron@stimio.fr>
Loading
Please sign in to comment