[linux-yocto] [PATCH 2/2] driver: usb: otg: fix build warning
Meng.Li at windriver.com
Meng.Li at windriver.com
Fri Nov 15 01:20:45 PST 2019
From: Limeng <Meng.Li at windriver.com>
Fix in file dwc_otg_pcd_intr.c
It is not reasonable to set the size of an array with a variable.
So, instead of define array directly, use kmalloc() to apply
memory space, and free it with kfree().
Fix in file dwc_otg_hcd_linux.c
Use the correct format string to output warning information.
Signed-off-by: Meng Li <Meng.Li at windriver.com>
---
drivers/usb/host/dwc_otg/dwc_otg_hcd_linux.c | 4 ++--
drivers/usb/host/dwc_otg/dwc_otg_pcd_intr.c | 6 ++++--
2 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/drivers/usb/host/dwc_otg/dwc_otg_hcd_linux.c b/drivers/usb/host/dwc_otg/dwc_otg_hcd_linux.c
index 08a3e41038a3..b2bb701f187e 100644
--- a/drivers/usb/host/dwc_otg/dwc_otg_hcd_linux.c
+++ b/drivers/usb/host/dwc_otg/dwc_otg_hcd_linux.c
@@ -482,8 +482,8 @@ static void hcd_init_fiq(void *cookie)
otg_dev->os_dep.mphi_base + 0x1f0;
dwc_otg_hcd->fiq_state->mphi_regs.swirq_clr =
otg_dev->os_dep.mphi_base + 0x1f4;
- DWC_WARN("Fake MPHI regs_base at 0x%08x",
- (int)dwc_otg_hcd->fiq_state->mphi_regs.base);
+ DWC_WARN("Fake MPHI regs_base at %px",
+ dwc_otg_hcd->fiq_state->mphi_regs.base);
} else {
dwc_otg_hcd->fiq_state->mphi_regs.ctrl =
otg_dev->os_dep.mphi_base + 0x4c;
diff --git a/drivers/usb/host/dwc_otg/dwc_otg_pcd_intr.c b/drivers/usb/host/dwc_otg/dwc_otg_pcd_intr.c
index e55ea9c74be4..8e88f6898998 100644
--- a/drivers/usb/host/dwc_otg/dwc_otg_pcd_intr.c
+++ b/drivers/usb/host/dwc_otg/dwc_otg_pcd_intr.c
@@ -3377,7 +3377,7 @@ void predict_nextep_seq( dwc_otg_core_if_t * core_if)
dtknq1_data_t dtknqr1;
uint32_t in_tkn_epnums[4];
uint8_t seqnum[MAX_EPS_CHANNELS];
- uint8_t intkn_seq[TOKEN_Q_DEPTH];
+ uint8_t *intkn_seq;
grstctl_t resetctl = {.d32 = 0 };
uint8_t temp;
int ndx = 0;
@@ -3390,6 +3390,8 @@ void predict_nextep_seq( dwc_otg_core_if_t * core_if)
DWC_DEBUGPL(DBG_PCD,"dev_token_q_depth=%d\n",TOKEN_Q_DEPTH);
+ intkn_seq = kmalloc(TOKEN_Q_DEPTH, GFP_KERNEL);
+
/* Read the DTKNQ Registers */
for (i = 0; i < DTKNQ_REG_CNT; i++) {
in_tkn_epnums[i] = DWC_READ_REG32(addr);
@@ -3530,7 +3532,7 @@ void predict_nextep_seq( dwc_otg_core_if_t * core_if)
resetctl.b.intknqflsh = 1;
DWC_WRITE_REG32(&core_if->core_global_regs->grstctl, resetctl.d32);
-
+ kfree(intkn_seq);
}
/**
--
2.17.1
More information about the linux-yocto
mailing list