lkml.org 
[lkml]   [2023]   [Mar]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v3 01/28] xhci: Add support to allocate several interrupters
On Thu, 09 Mar 2023 00:57:24 +0100,
Wesley Cheng wrote:
> +struct xhci_interrupter *
> +xhci_create_secondary_interrupter(struct usb_hcd *hcd, int intr_num)
> +{
> + struct xhci_hcd *xhci = hcd_to_xhci(hcd);
> + struct xhci_interrupter *ir;
> + unsigned int i;
> + unsigned int idx = 0;
> + unsigned long flags;
> +
> + if (!xhci->interrupters || intr_num > xhci->max_interrupters)
> + return NULL;
> +
> + spin_lock_irqsave(&xhci->lock, flags);
....
> + if (idx > 0) {
> + ir = xhci_alloc_interrupter(xhci, idx, GFP_KERNEL);
> + if (!ir) {
> + spin_unlock_irqrestore(&xhci->lock, flags);
> + return NULL;
> + }
> + ir->intr_num = idx;
> + xhci->interrupters[idx] = ir;
> + spin_unlock_irqrestore(&xhci->lock, flags);

You can't use GFP_KERNEL allocation inside the spinlock.


Takashi

\
 
 \ /
  Last update: 2023-03-27 00:51    [W:0.905 / U:0.804 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site