drivers/telnet: Let psock_poll check the valid of td_psock instead
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
parent
a52fbe87eb
commit
c3b6d35290
@ -1228,20 +1228,9 @@ static int telnet_poll(FAR struct file *filep, FAR struct pollfd *fds,
|
||||
{
|
||||
FAR struct inode *inode = filep->f_inode;
|
||||
FAR struct telnet_dev_s *priv = inode->i_private;
|
||||
FAR struct socket *psock;
|
||||
|
||||
DEBUGASSERT(fds != NULL);
|
||||
|
||||
/* Get the underlying socket structure and verify that the sockfd
|
||||
* corresponds to valid, allocated socket
|
||||
*/
|
||||
|
||||
psock = &priv->td_psock;
|
||||
if (psock == NULL || psock->s_conn == NULL)
|
||||
{
|
||||
return -EBADF;
|
||||
}
|
||||
|
||||
/* Test if we have cached data waiting to be read */
|
||||
|
||||
if (priv->td_pending > 0)
|
||||
@ -1253,7 +1242,7 @@ static int telnet_poll(FAR struct file *filep, FAR struct pollfd *fds,
|
||||
|
||||
/* Then let psock_poll() do the heavy lifting */
|
||||
|
||||
return psock_poll(psock, fds, setup);
|
||||
return psock_poll(&priv->td_psock, fds, setup);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
|
Loading…
x
Reference in New Issue
Block a user