usb: dwc3: make dwc3_debugfs_init return value be void
Debugfs init failure is not so important. We can continue our job on this failure. Also no break need for debugfs_create_file call failure. Signed-off-by: Du, Changbin <changbin.du@intel.com> [felipe.balbi@linux.intel.com : - remove out-of-memory message, we get that from OOM. - switch dev_err() to dev_dbg() ] Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
This commit is contained in:
parent
af566a0be6
commit
4e9f311833
@ -1030,19 +1030,11 @@ static int dwc3_probe(struct platform_device *pdev)
|
|||||||
if (ret)
|
if (ret)
|
||||||
goto err5;
|
goto err5;
|
||||||
|
|
||||||
ret = dwc3_debugfs_init(dwc);
|
dwc3_debugfs_init(dwc);
|
||||||
if (ret) {
|
|
||||||
dev_err(dev, "failed to initialize debugfs\n");
|
|
||||||
goto err6;
|
|
||||||
}
|
|
||||||
|
|
||||||
pm_runtime_allow(dev);
|
pm_runtime_allow(dev);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
err6:
|
|
||||||
dwc3_core_exit_mode(dwc);
|
|
||||||
|
|
||||||
err5:
|
err5:
|
||||||
dwc3_event_buffers_cleanup(dwc);
|
dwc3_event_buffers_cleanup(dwc);
|
||||||
|
|
||||||
|
@ -217,11 +217,11 @@ static inline const char *dwc3_gadget_event_type_string(u8 event)
|
|||||||
void dwc3_trace(void (*trace)(struct va_format *), const char *fmt, ...);
|
void dwc3_trace(void (*trace)(struct va_format *), const char *fmt, ...);
|
||||||
|
|
||||||
#ifdef CONFIG_DEBUG_FS
|
#ifdef CONFIG_DEBUG_FS
|
||||||
extern int dwc3_debugfs_init(struct dwc3 *);
|
extern void dwc3_debugfs_init(struct dwc3 *);
|
||||||
extern void dwc3_debugfs_exit(struct dwc3 *);
|
extern void dwc3_debugfs_exit(struct dwc3 *);
|
||||||
#else
|
#else
|
||||||
static inline int dwc3_debugfs_init(struct dwc3 *d)
|
static inline void dwc3_debugfs_init(struct dwc3 *d)
|
||||||
{ return 0; }
|
{ }
|
||||||
static inline void dwc3_debugfs_exit(struct dwc3 *d)
|
static inline void dwc3_debugfs_exit(struct dwc3 *d)
|
||||||
{ }
|
{ }
|
||||||
#endif
|
#endif
|
||||||
|
@ -618,24 +618,23 @@ static const struct file_operations dwc3_link_state_fops = {
|
|||||||
.release = single_release,
|
.release = single_release,
|
||||||
};
|
};
|
||||||
|
|
||||||
int dwc3_debugfs_init(struct dwc3 *dwc)
|
void dwc3_debugfs_init(struct dwc3 *dwc)
|
||||||
{
|
{
|
||||||
struct dentry *root;
|
struct dentry *root;
|
||||||
struct dentry *file;
|
struct dentry *file;
|
||||||
int ret;
|
|
||||||
|
|
||||||
root = debugfs_create_dir(dev_name(dwc->dev), NULL);
|
root = debugfs_create_dir(dev_name(dwc->dev), NULL);
|
||||||
if (!root) {
|
if (IS_ERR_OR_NULL(root)) {
|
||||||
ret = -ENOMEM;
|
if (!root)
|
||||||
goto err0;
|
dev_err(dwc->dev, "Can't create debugfs root\n");
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
dwc->root = root;
|
dwc->root = root;
|
||||||
|
|
||||||
dwc->regset = kzalloc(sizeof(*dwc->regset), GFP_KERNEL);
|
dwc->regset = kzalloc(sizeof(*dwc->regset), GFP_KERNEL);
|
||||||
if (!dwc->regset) {
|
if (!dwc->regset) {
|
||||||
ret = -ENOMEM;
|
debugfs_remove_recursive(root);
|
||||||
goto err1;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
dwc->regset->regs = dwc3_regs;
|
dwc->regset->regs = dwc3_regs;
|
||||||
@ -643,44 +642,28 @@ int dwc3_debugfs_init(struct dwc3 *dwc)
|
|||||||
dwc->regset->base = dwc->regs;
|
dwc->regset->base = dwc->regs;
|
||||||
|
|
||||||
file = debugfs_create_regset32("regdump", S_IRUGO, root, dwc->regset);
|
file = debugfs_create_regset32("regdump", S_IRUGO, root, dwc->regset);
|
||||||
if (!file) {
|
if (!file)
|
||||||
ret = -ENOMEM;
|
dev_dbg(dwc->dev, "Can't create debugfs regdump\n");
|
||||||
goto err1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (IS_ENABLED(CONFIG_USB_DWC3_DUAL_ROLE)) {
|
if (IS_ENABLED(CONFIG_USB_DWC3_DUAL_ROLE)) {
|
||||||
file = debugfs_create_file("mode", S_IRUGO | S_IWUSR, root,
|
file = debugfs_create_file("mode", S_IRUGO | S_IWUSR, root,
|
||||||
dwc, &dwc3_mode_fops);
|
dwc, &dwc3_mode_fops);
|
||||||
if (!file) {
|
if (!file)
|
||||||
ret = -ENOMEM;
|
dev_dbg(dwc->dev, "Can't create debugfs mode\n");
|
||||||
goto err1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IS_ENABLED(CONFIG_USB_DWC3_DUAL_ROLE) ||
|
if (IS_ENABLED(CONFIG_USB_DWC3_DUAL_ROLE) ||
|
||||||
IS_ENABLED(CONFIG_USB_DWC3_GADGET)) {
|
IS_ENABLED(CONFIG_USB_DWC3_GADGET)) {
|
||||||
file = debugfs_create_file("testmode", S_IRUGO | S_IWUSR, root,
|
file = debugfs_create_file("testmode", S_IRUGO | S_IWUSR, root,
|
||||||
dwc, &dwc3_testmode_fops);
|
dwc, &dwc3_testmode_fops);
|
||||||
if (!file) {
|
if (!file)
|
||||||
ret = -ENOMEM;
|
dev_dbg(dwc->dev, "Can't create debugfs testmode\n");
|
||||||
goto err1;
|
|
||||||
}
|
|
||||||
|
|
||||||
file = debugfs_create_file("link_state", S_IRUGO | S_IWUSR, root,
|
file = debugfs_create_file("link_state", S_IRUGO | S_IWUSR,
|
||||||
dwc, &dwc3_link_state_fops);
|
root, dwc, &dwc3_link_state_fops);
|
||||||
if (!file) {
|
if (!file)
|
||||||
ret = -ENOMEM;
|
dev_dbg(dwc->dev, "Can't create debugfs link_state\n");
|
||||||
goto err1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
err1:
|
|
||||||
debugfs_remove_recursive(root);
|
|
||||||
|
|
||||||
err0:
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void dwc3_debugfs_exit(struct dwc3 *dwc)
|
void dwc3_debugfs_exit(struct dwc3 *dwc)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user