Hi Jack,
On 3/15/23 11:25 PM, Jack Pham wrote:
Hi Udipto,
On Wed, Mar 15, 2023 at 06:17:05PM +0530, Udipto Goswami wrote:
When the dwc3 device is runtime suspended, various required clocks would
get disabled and it is not guaranteed that access to any registers would
work. Depending on the SoC glue, a register read could be as benign as
returning 0 or be fatal enough to hang the system.
In order to prevent such scenarios of fatal errors, bail out of debugfs
function is dwc3 is suspended.
Signed-off-by: Udipto Goswami <quic_ugoswami@xxxxxxxxxxx>
---
v2: Replaced return 0 with -EINVAL & seq_puts with pr_err.
drivers/usb/dwc3/debugfs.c | 50 ++++++++++++++++++++++++++++++++++++++
1 file changed, 50 insertions(+)
diff --git a/drivers/usb/dwc3/debugfs.c b/drivers/usb/dwc3/debugfs.c
index 850df0e6bcab..0e6cf7b89f8b 100644
--- a/drivers/usb/dwc3/debugfs.c
+++ b/drivers/usb/dwc3/debugfs.c
@@ -544,6 +544,11 @@ static int dwc3_link_state_show(struct seq_file *s, void *unused)
u32 reg;
u8 speed;
+ if (pm_runtime_suspended(dwc->dev)) {
+ pr_err("Invalid operation, DWC3 suspended!");
Use dev_err() please.
Sure, i'll update in the next version.
Thanks,
Jack
Thanks,
-Udipto