llseek: automatically add .llseek fop
[firefly-linux-kernel-4.4.55.git] / drivers / char / ip2 / ip2main.c
index 07f3ea38b5828eda0a16ceed8b23fdbdee891d79..2e49e515d8e7037b5dd2edbca23db380db58717a 100644 (file)
@@ -236,6 +236,7 @@ static const struct file_operations ip2_ipl = {
        .write          = ip2_ipl_write,
        .unlocked_ioctl = ip2_ipl_ioctl,
        .open           = ip2_ipl_open,
+       .llseek         = noop_llseek,
 }; 
 
 static unsigned long irq_counter;
@@ -1650,7 +1651,7 @@ ip2_close( PTTY tty, struct file *pFile )
        /* disable DSS reporting */
        i2QueueCommands(PTYPE_INLINE, pCh, 100, 4,
                                CMD_DCD_NREP, CMD_CTS_NREP, CMD_DSR_NREP, CMD_RI_NREP);
-       if ( !tty || (tty->termios->c_cflag & HUPCL) ) {
+       if (tty->termios->c_cflag & HUPCL) {
                i2QueueCommands(PTYPE_INLINE, pCh, 100, 2, CMD_RTSDN, CMD_DTRDN);
                pCh->dataSetOut &= ~(I2_DTR | I2_RTS);
                i2QueueCommands( PTYPE_INLINE, pCh, 100, 1, CMD_PAUSE(25));
@@ -2930,6 +2931,8 @@ ip2_ipl_ioctl (struct file *pFile, UINT cmd, ULONG arg )
                                if ( pCh )
                                {
                                        rc = copy_to_user(argp, pCh, sizeof(i2ChanStr));
+                                       if (rc)
+                                               rc = -EFAULT;
                                } else {
                                        rc = -ENODEV;
                                }