File tree Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -1529,10 +1529,13 @@ static ssize_t soft_connect_store(struct device *dev,
1529
1529
struct device_attribute * attr , const char * buf , size_t n )
1530
1530
{
1531
1531
struct usb_udc * udc = container_of (dev , struct usb_udc , dev );
1532
+ ssize_t ret ;
1532
1533
1534
+ mutex_lock (& udc_lock );
1533
1535
if (!udc -> driver ) {
1534
1536
dev_err (dev , "soft-connect without a gadget driver\n" );
1535
- return - EOPNOTSUPP ;
1537
+ ret = - EOPNOTSUPP ;
1538
+ goto out ;
1536
1539
}
1537
1540
1538
1541
if (sysfs_streq (buf , "connect" )) {
@@ -1543,10 +1546,14 @@ static ssize_t soft_connect_store(struct device *dev,
1543
1546
usb_gadget_udc_stop (udc );
1544
1547
} else {
1545
1548
dev_err (dev , "unsupported command '%s'\n" , buf );
1546
- return - EINVAL ;
1549
+ ret = - EINVAL ;
1550
+ goto out ;
1547
1551
}
1548
1552
1549
- return n ;
1553
+ ret = n ;
1554
+ out :
1555
+ mutex_unlock (& udc_lock );
1556
+ return ret ;
1550
1557
}
1551
1558
static DEVICE_ATTR_WO (soft_connect );
1552
1559
You can’t perform that action at this time.
0 commit comments