summaryrefslogtreecommitdiff
path: root/drivers/usb
diff options
context:
space:
mode:
authorRui Miguel Silva <rui.silva@linaro.org>2021-08-27 14:11:50 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2021-08-27 16:11:38 +0200
commitf757f9291f920e1da4c6cfd4064c6bf59639983e (patch)
treec6a9351a7bc6738bc913d7b263d5111d95351d23 /drivers/usb
parentf73800a905a8a9c35b989e8de9ce5cdf328c2b63 (diff)
downloadlwn-f757f9291f920e1da4c6cfd4064c6bf59639983e.tar.gz
lwn-f757f9291f920e1da4c6cfd4064c6bf59639983e.zip
usb: isp1760: fix memory pool initialization
The loops to setup the memory pool were skipping some blocks, that was not visible on the ISP1763 because it has fewer blocks than the ISP1761. But won testing on that IP from the family that would be an issue. Reported-by: Dietmar Eggemann <dietmar.eggemann@arm.com> Tested-by: Dietmar Eggemann <dietmar.eggemann@arm.com> Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org> Link: https://lore.kernel.org/r/20210827131154.4151862-2-rui.silva@linaro.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/isp1760/isp1760-hcd.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/usb/isp1760/isp1760-hcd.c b/drivers/usb/isp1760/isp1760-hcd.c
index bf8ab3fe2e5a..b3a55c5d2155 100644
--- a/drivers/usb/isp1760/isp1760-hcd.c
+++ b/drivers/usb/isp1760/isp1760-hcd.c
@@ -588,8 +588,8 @@ static void init_memory(struct isp1760_hcd *priv)
payload_addr = PAYLOAD_OFFSET;
- for (i = 0, curr = 0; i < ARRAY_SIZE(mem->blocks); i++) {
- for (j = 0; j < mem->blocks[i]; j++, curr++) {
+ for (i = 0, curr = 0; i < ARRAY_SIZE(mem->blocks); i++, curr += j) {
+ for (j = 0; j < mem->blocks[i]; j++) {
priv->memory_pool[curr + j].start = payload_addr;
priv->memory_pool[curr + j].size = mem->blocks_size[i];
priv->memory_pool[curr + j].free = 1;