@@ -205,7 +205,6 @@ static int __set_selection(const struct tiocl_selection __user *sel, struct tty_
205
205
pe = tmp ;
206
206
}
207
207
208
- mutex_lock (& sel_lock );
209
208
if (sel_cons != vc_cons [fg_console ].d ) {
210
209
clear_selection ();
211
210
sel_cons = vc_cons [fg_console ].d ;
@@ -251,10 +250,9 @@ static int __set_selection(const struct tiocl_selection __user *sel, struct tty_
251
250
break ;
252
251
case TIOCL_SELPOINTER :
253
252
highlight_pointer (pe );
254
- goto unlock ;
253
+ return 0 ;
255
254
default :
256
- ret = - EINVAL ;
257
- goto unlock ;
255
+ return - EINVAL ;
258
256
}
259
257
260
258
/* remove the pointer */
@@ -276,7 +274,7 @@ static int __set_selection(const struct tiocl_selection __user *sel, struct tty_
276
274
else if (new_sel_start == sel_start )
277
275
{
278
276
if (new_sel_end == sel_end ) /* no action required */
279
- goto unlock ;
277
+ return 0 ;
280
278
else if (new_sel_end > sel_end ) /* extend to right */
281
279
highlight (sel_end + 2 , new_sel_end );
282
280
else /* contract from right */
@@ -303,8 +301,7 @@ static int __set_selection(const struct tiocl_selection __user *sel, struct tty_
303
301
if (!bp ) {
304
302
printk (KERN_WARNING "selection: kmalloc() failed\n" );
305
303
clear_selection ();
306
- ret = - ENOMEM ;
307
- goto unlock ;
304
+ return - ENOMEM ;
308
305
}
309
306
kfree (sel_buffer );
310
307
sel_buffer = bp ;
@@ -329,18 +326,19 @@ static int __set_selection(const struct tiocl_selection __user *sel, struct tty_
329
326
}
330
327
}
331
328
sel_buffer_lth = bp - sel_buffer ;
332
- unlock :
333
- mutex_unlock (& sel_lock );
329
+
334
330
return ret ;
335
331
}
336
332
337
333
int set_selection (const struct tiocl_selection __user * v , struct tty_struct * tty )
338
334
{
339
335
int ret ;
340
336
337
+ mutex_lock (& sel_lock );
341
338
console_lock ();
342
339
ret = __set_selection (v , tty );
343
340
console_unlock ();
341
+ mutex_unlock (& sel_lock );
344
342
345
343
return ret ;
346
344
}
0 commit comments