Skip to content

Commit 212e7bb

Browse files
jirislabytorvalds
authored andcommitted
Char: rio, fix sparse warnings
Add some locks and unlocks to some code paths. Signed-off-by: Jiri Slaby <jirislaby@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 3d0ae36 commit 212e7bb

2 files changed

Lines changed: 7 additions & 1 deletion

File tree

‎drivers/char/rio/riotable.c‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -425,8 +425,10 @@ int RIOApel(struct rio_info *p)
425425

426426
MapP = &p->RIOConnectTable[Next++];
427427
MapP->HostUniqueNum = HostP->UniqueNum;
428-
if ((HostP->Flags & RUN_STATE) != RC_RUNNING)
428+
if ((HostP->Flags & RUN_STATE) != RC_RUNNING) {
429+
rio_spin_unlock_irqrestore(&HostP->HostLock, flags);
429430
continue;
431+
}
430432
MapP->RtaUniqueNum = 0;
431433
MapP->ID = 0;
432434
MapP->Flags = SLOT_IN_USE;

‎drivers/char/rio/riotty.c‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -319,6 +319,7 @@ int riotopen(struct tty_struct *tty, struct file *filp)
319319
PortP->State |= RIO_WOPEN;
320320
rio_spin_unlock_irqrestore(&PortP->portSem, flags);
321321
if (RIODelay(PortP, HUNDRED_MS) == RIO_FAIL) {
322+
rio_spin_lock_irqsave(&PortP->portSem, flags);
322323
/*
323324
** ACTION: verify that this is a good thing
324325
** to do here. -- ???
@@ -334,6 +335,7 @@ int riotopen(struct tty_struct *tty, struct file *filp)
334335
func_exit();
335336
return -EINTR;
336337
}
338+
rio_spin_lock_irqsave(&PortP->portSem, flags);
337339
}
338340
PortP->State &= ~RIO_WOPEN;
339341
}
@@ -493,6 +495,7 @@ int riotclose(void *ptr)
493495

494496
if (RIOShortCommand(p, PortP, CLOSE, 1, 0) == RIO_FAIL) {
495497
RIOPreemptiveCmd(p, PortP, FCLOSE);
498+
rio_spin_lock_irqsave(&PortP->portSem, flags);
496499
goto close_end;
497500
}
498501

@@ -508,6 +511,7 @@ int riotclose(void *ptr)
508511

509512
if (p->RIOHalted) {
510513
RIOClearUp(PortP);
514+
rio_spin_lock_irqsave(&PortP->portSem, flags);
511515
goto close_end;
512516
}
513517
if (RIODelay(PortP, HUNDRED_MS) == RIO_FAIL) {

0 commit comments

Comments
 (0)