Skip to content

Commit 8d33e82

Browse files
jhovoldgregkh
authored andcommitted
USB: iowarrior: drop redundant iowarrior mutex
Drop the redundant iowarrior mutex introduced by commit 925ce68 ("USB: autoconvert trivial BKL users to private mutex") which replaced an earlier BKL use. The lock serialised calls to open() against other open() and ioctl(), but neither is needed. Signed-off-by: Johan Hovold <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 7c5b971 commit 8d33e82

File tree

1 file changed

+1
-12
lines changed

1 file changed

+1
-12
lines changed

drivers/usb/misc/iowarrior.c

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,6 @@ MODULE_AUTHOR(DRIVER_AUTHOR);
5454
MODULE_DESCRIPTION(DRIVER_DESC);
5555
MODULE_LICENSE("GPL");
5656

57-
/* Module parameters */
58-
static DEFINE_MUTEX(iowarrior_mutex);
59-
6057
static struct usb_driver iowarrior_driver;
6158

6259
/*--------------*/
@@ -480,8 +477,6 @@ static long iowarrior_ioctl(struct file *file, unsigned int cmd,
480477
if (!buffer)
481478
return -ENOMEM;
482479

483-
/* lock this object */
484-
mutex_lock(&iowarrior_mutex);
485480
mutex_lock(&dev->mutex);
486481

487482
/* verify that the device wasn't unplugged */
@@ -574,7 +569,6 @@ static long iowarrior_ioctl(struct file *file, unsigned int cmd,
574569
error_out:
575570
/* unlock the device */
576571
mutex_unlock(&dev->mutex);
577-
mutex_unlock(&iowarrior_mutex);
578572
kfree(buffer);
579573
return retval;
580574
}
@@ -589,22 +583,18 @@ static int iowarrior_open(struct inode *inode, struct file *file)
589583
int subminor;
590584
int retval = 0;
591585

592-
mutex_lock(&iowarrior_mutex);
593586
subminor = iminor(inode);
594587

595588
interface = usb_find_interface(&iowarrior_driver, subminor);
596589
if (!interface) {
597-
mutex_unlock(&iowarrior_mutex);
598590
printk(KERN_ERR "%s - error, can't find device for minor %d\n",
599591
__func__, subminor);
600592
return -ENODEV;
601593
}
602594

603595
dev = usb_get_intfdata(interface);
604-
if (!dev) {
605-
mutex_unlock(&iowarrior_mutex);
596+
if (!dev)
606597
return -ENODEV;
607-
}
608598

609599
mutex_lock(&dev->mutex);
610600

@@ -628,7 +618,6 @@ static int iowarrior_open(struct inode *inode, struct file *file)
628618

629619
out:
630620
mutex_unlock(&dev->mutex);
631-
mutex_unlock(&iowarrior_mutex);
632621
return retval;
633622
}
634623

0 commit comments

Comments
 (0)