lkml.org 
[lkml]   [2021]   [May]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 21/24] usb: host: xhci: Move array of structs from the stack onto the heap
Date
Fixes the following W=1 kernel build warning(s):

drivers/usb/host/xhci.c: In function ‘xhci_reserve_bandwidth’:
drivers/usb/host/xhci.c:2859:1: warning: the frame size of 1032 bytes is larger than 1024 bytes [-Wframe-larger-than=]

Cc: Mathias Nyman <mathias.nyman@intel.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: linux-usb@vger.kernel.org
Signed-off-by: Lee Jones <lee.jones@linaro.org>
---
drivers/usb/host/xhci.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
index ac2a7d4288883..40ce4b4eb12ad 100644
--- a/drivers/usb/host/xhci.c
+++ b/drivers/usb/host/xhci.c
@@ -2773,7 +2773,7 @@ static int xhci_reserve_bandwidth(struct xhci_hcd *xhci,
struct xhci_virt_device *virt_dev,
struct xhci_container_ctx *in_ctx)
{
- struct xhci_bw_info ep_bw_info[31];
+ struct xhci_bw_info *ep_bw_info;
int i;
struct xhci_input_control_ctx *ctrl_ctx;
int old_active_eps = 0;
@@ -2788,6 +2788,10 @@ static int xhci_reserve_bandwidth(struct xhci_hcd *xhci,
return -ENOMEM;
}

+ ep_bw_info = kzalloc(sizeof(*ep_bw_info) * 31, GFP_KERNEL);
+ if (!ep_bw_info)
+ return -ENOMEM;
+
for (i = 0; i < 31; i++) {
if (!EP_IS_ADDED(ctrl_ctx, i) && !EP_IS_DROPPED(ctrl_ctx, i))
continue;
@@ -2824,6 +2828,7 @@ static int xhci_reserve_bandwidth(struct xhci_hcd *xhci,
* Update the number of active TTs.
*/
xhci_update_tt_active_eps(xhci, virt_dev, old_active_eps);
+ kfree(ep_bw_info);
return 0;
}

@@ -2855,6 +2860,7 @@ static int xhci_reserve_bandwidth(struct xhci_hcd *xhci,
&virt_dev->eps[i],
virt_dev->tt_info);
}
+ kfree(ep_bw_info);
return -ENOMEM;
}

--
2.31.1
\
 
 \ /
  Last update: 2021-05-26 15:03    [W:0.239 / U:0.152 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site