usb: dwc3: debugfs: Add LPM check for ep_info_register

Prevent unclocked access if this debugfs parameter is
attempted to be read when USB controller is powered off.

Change-Id: I5a563ea75807d95f0d6d6c5b037db48681d89625
Signed-off-by: Jack Pham <jackp@codeaurora.org>
This commit is contained in:
Jack Pham 2020-06-05 18:26:23 -07:00
commit 090d777fe3

View file

@ -921,6 +921,11 @@ static int dwc3_ep_info_register_show(struct seq_file *s, void *unused)
u32 upper_32_bits;
u32 reg;
if (atomic_read(&dwc->in_lpm)) {
seq_puts(s, "USB device is powered off\n");
return 0;
}
spin_lock_irqsave(&dwc->lock, flags);
reg = DWC3_GDBGLSPMUX_EPSELECT(dep->number);
dwc3_writel(dwc->regs, DWC3_GDBGLSPMUX, reg);