diff options
Diffstat (limited to 'drivers/tty/hvc/hvcs.c')
-rw-r--r-- | drivers/tty/hvc/hvcs.c | 24 |
1 files changed, 10 insertions, 14 deletions
diff --git a/drivers/tty/hvc/hvcs.c b/drivers/tty/hvc/hvcs.c index da0aa476804d..d23759183b47 100644 --- a/drivers/tty/hvc/hvcs.c +++ b/drivers/tty/hvc/hvcs.c | |||
@@ -1090,27 +1090,23 @@ static int hvcs_enable_device(struct hvcs_struct *hvcsd, uint32_t unit_address, | |||
1090 | */ | 1090 | */ |
1091 | static struct hvcs_struct *hvcs_get_by_index(int index) | 1091 | static struct hvcs_struct *hvcs_get_by_index(int index) |
1092 | { | 1092 | { |
1093 | struct hvcs_struct *hvcsd = NULL; | 1093 | struct hvcs_struct *hvcsd; |
1094 | unsigned long flags; | 1094 | unsigned long flags; |
1095 | 1095 | ||
1096 | spin_lock(&hvcs_structs_lock); | 1096 | spin_lock(&hvcs_structs_lock); |
1097 | /* We can immediately discard OOB requests */ | 1097 | list_for_each_entry(hvcsd, &hvcs_structs, next) { |
1098 | if (index >= 0 && index < HVCS_MAX_SERVER_ADAPTERS) { | 1098 | spin_lock_irqsave(&hvcsd->lock, flags); |
1099 | list_for_each_entry(hvcsd, &hvcs_structs, next) { | 1099 | if (hvcsd->index == index) { |
1100 | spin_lock_irqsave(&hvcsd->lock, flags); | 1100 | kref_get(&hvcsd->kref); |
1101 | if (hvcsd->index == index) { | ||
1102 | kref_get(&hvcsd->kref); | ||
1103 | spin_unlock_irqrestore(&hvcsd->lock, flags); | ||
1104 | spin_unlock(&hvcs_structs_lock); | ||
1105 | return hvcsd; | ||
1106 | } | ||
1107 | spin_unlock_irqrestore(&hvcsd->lock, flags); | 1101 | spin_unlock_irqrestore(&hvcsd->lock, flags); |
1102 | spin_unlock(&hvcs_structs_lock); | ||
1103 | return hvcsd; | ||
1108 | } | 1104 | } |
1109 | hvcsd = NULL; | 1105 | spin_unlock_irqrestore(&hvcsd->lock, flags); |
1110 | } | 1106 | } |
1111 | |||
1112 | spin_unlock(&hvcs_structs_lock); | 1107 | spin_unlock(&hvcs_structs_lock); |
1113 | return hvcsd; | 1108 | |
1109 | return NULL; | ||
1114 | } | 1110 | } |
1115 | 1111 | ||
1116 | /* | 1112 | /* |