Am Sonntag 12 August 2007 schrieb [EMAIL PROTECTED]:
> In this release, the driver use the interrupt context.
> So no more latency problem.
> I still kfree the buffers provided by the usb-serial framework.
> 
> All comments/remarks are welcome
> 
> This driver seems very stable ( tested with 5 readers at the same time )
> 
> Alain
> 

+static int iuu_alloc_buf(struct iuu_private *priv)
+{
+       priv->buf = kzalloc(256, GFP_KERNEL);
+       priv->dbgbuf = kzalloc(256, GFP_KERNEL);
+       priv->writebuf = kzalloc(256, GFP_KERNEL);
+       if (!priv->buf || !priv->dbgbuf || !priv->writebuf) {
+               dbg("%s problem allocation buffer", __FUNCTION__);
+               return -ENOMEM;
+       }
+       return 0;
+}

Memory leak. Only one allocation may have failed. You should
free all allocations in the error case. kfree() can take NULL.

+static int iuu_free_buf(struct iuu_private *priv)
+{
+       kfree(priv->buf);
+       kfree(priv->dbgbuf);
+       kfree(priv->writebuf);
+       return 0;
+}

What could fail? Make it void.

+       if (!(set & TIOCM_RTS) && priv->TIOSTATUS == TIOCM_RTS) {
+               dbg("%s TIOCMSET RESET called !!!", __FUNCTION__);
+               priv->reset = 1;
+               /* force waiting before return
+                * needed by ctapi phoenix driver */
+               current->state = TASK_UNINTERRUPTIBLE;
+               schedule_timeout(1 + 1000 * HZ / 1000);
+               return 0;
+       }
+

The tty code can leave you on a waitqueue and wake you prematurely.
You must use a real waiting primitive.

+       kfree(port->bulk_out_buffer) ;
+       port->bulk_out_buffer = kmalloc(512, GFP_KERNEL);
+       port->bulk_out_size = 512 ;
+       kfree(port->bulk_in_buffer) ;
+       port->bulk_in_buffer = kmalloc(512, GFP_KERNEL);
+       port->bulk_in_size = 512 ;

This needs error handling.

And some other issues. Please fix this and resend.

        Regards
                Oliver

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to