usb: gadget: mtp: Move mutex_init() to alloc_inst_mtp_ptp()
Now mutex_init() is in function_alloc_mtp_ptp() which will be called when USB composition change. In the corner case, USB composition change when do mtp_read(), the mutex lock is initialized when do mutex_lock(). Change-Id: I7a61f6fe6d8865462c5445f7075722f4f151b03f Signed-off-by: Liangliang Lu <luliang@codeaurora.org>
This commit is contained in:
parent
8d60131090
commit
091b49d5ea
1 changed files with 2 additions and 1 deletions
|
@ -1854,6 +1854,8 @@ struct usb_function_instance *alloc_inst_mtp_ptp(bool mtp_config)
|
|||
config_group_init_type_name(&fi_mtp->func_inst.group,
|
||||
"", &mtp_func_type);
|
||||
|
||||
mutex_init(&fi_mtp->dev->read_mutex);
|
||||
|
||||
return &fi_mtp->func_inst;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(alloc_inst_mtp_ptp);
|
||||
|
@ -1916,7 +1918,6 @@ struct usb_function *function_alloc_mtp_ptp(struct usb_function_instance *fi,
|
|||
dev->is_ptp = !mtp_config;
|
||||
fi->f = &dev->function;
|
||||
|
||||
mutex_init(&dev->read_mutex);
|
||||
return &dev->function;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(function_alloc_mtp_ptp);
|
||||
|
|
Loading…
Add table
Reference in a new issue