---
name: "usb_alloc_urb"
section: "9"
platform: "linux"
package: "linux-manual-4.9"
version: "4.9.228-1"
release: "Debian 9 (Stretch)"
platforms: ["linux"]
url: "https://new.carta.tech/usb_alloc_urb"
---

# usb\_alloc\_urb(9)

creates a new urb for a USB driver to use

## NAME

usb\_alloc\_urb - creates a new urb for a USB driver to use

## SYNOPSIS

**struct urb \* usb\_alloc\_urb(int** *iso\_packets***, gfp\_t** *mem\_flags***);**

## ARGUMENTS

*iso\_packets*

number of iso packets for this urb

*mem\_flags*

the type of memory to allocate, see **kmalloc** for a list of valid options for this.

## DESCRIPTION

Creates an urb for the USB driver to use, initializes a few internal structures, increments the usage counter, and returns a pointer to it.

If the driver want to use this urb for interrupt, control, or bulk endpoints, pass '0' as the number of iso packets.

The driver must call **usb\_free\_urb** when it is finished with the urb.

## RETURN

A pointer to the new urb, or **NULL** if no memory is available.

## COPYRIGHT
