From: Pavel Pisa Date: Sat, 1 Oct 2011 20:44:53 +0000 (+0200) Subject: Corrected CAN queues locking for corner case - i.e. partially connected queue. X-Git-Url: http://rtime.felk.cvut.cz/gitweb/lincan.git/commitdiff_plain/21d8a0ab23ef9aa66557c7645c604887497f188a Corrected CAN queues locking for corner case - i.e. partially connected queue. Signed-off-by: Pavel Pisa --- diff --git a/lincan/src/can_queue.c b/lincan/src/can_queue.c index 6395207..a1aa1df 100644 --- a/lincan/src/can_queue.c +++ b/lincan/src/can_queue.c @@ -586,8 +586,8 @@ int canqueue_disconnect_edge(struct canque_edge_t *qedge) } else { DEBUGQUE("canqueue_disconnect_edge called with not fully connected edge"); if(inends) can_spin_lock_irqsave(&inends->ends_lock,flags); - if(outends) can_spin_lock(&outends->ends_lock); - flags=0; + else if(outends) can_spin_lock_irqsave(&outends->ends_lock,flags); + else flags=0; } can_spin_lock(&qedge->fifo.fifo_lock); @@ -609,8 +609,8 @@ int canqueue_disconnect_edge(struct canque_edge_t *qedge) if(inends && outends) { canque_edge_unlock_both_ends(inends, outends, flags); } else { - if(outends) can_spin_unlock(&outends->ends_lock); if(inends) can_spin_unlock_irqrestore(&inends->ends_lock,flags); + else if(outends) can_spin_unlock_irqrestore(&outends->ends_lock,flags); } DEBUGQUE("canqueue_disconnect_edge %d returned %d\n",qedge->edge_num,ret);