User: | Jiri Slaby |
Error type: | Double Lock |
Error type description: | Some lock is locked twice unintentionally in a sequence |
File location: | drivers/usb/serial/digi_acceleport.c |
Line in file: | 1371 |
Project: | Linux Kernel |
Project version: | 2.6.28 |
Tools: |
Clang Static Analyzer
(3.0)
Smatch (1.59) |
Entered: | 2012-04-17 12:29:30 UTC |
1341 struct file *filp) 1342{ 1343 int ret; 1344 unsigned char buf[32]; 1345 struct digi_port *priv = usb_get_serial_port_data(port); 1346 struct ktermios not_termios; 1347 unsigned long flags = 0; 1348 1349 dbg("digi_open: TOP: port=%d, open_count=%d", 1350 priv->dp_port_num, port->port.count); 1351 1352 /* be sure the device is started up */ 1353 if (digi_startup_device(port->serial) != 0) 1354 return -ENXIO; 1355 1356 spin_lock_irqsave(&priv->dp_port_lock, flags); 1357 1358 /* don't wait on a close in progress for non-blocking opens */ 1359 if (priv->dp_in_close && (filp->f_flags&(O_NDELAY|O_NONBLOCK)) == 0) { 1360 spin_unlock_irqrestore(&priv->dp_port_lock, flags); 1361 return -EAGAIN; 1362 } 1363 1364 /* wait for a close in progress to finish */ 1365 while (priv->dp_in_close) { 1366 cond_wait_interruptible_timeout_irqrestore( 1367 &priv->dp_close_wait, DIGI_RETRY_TIMEOUT, 1368 &priv->dp_port_lock, flags); 1369 if (signal_pending(current)) 1370 return -EINTR; 1371 spin_lock_irqsave(&priv->dp_port_lock, flags); 1372 } 1373 1374 spin_unlock_irqrestore(&priv->dp_port_lock, flags); 1375 1376 /* read modem signals automatically whenever they change */ 1377 buf[0] = DIGI_CMD_READ_INPUT_SIGNALS; 1378 buf[1] = priv->dp_port_num; 1379 buf[2] = DIGI_ENABLE; 1380 buf[3] = 0; 1381