---
name: "usb_alloc_dev"
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_dev"
---

# usb\_alloc\_dev(9)

usb device constructor (usbcore-internal)

## NAME

usb\_alloc\_dev - usb device constructor (usbcore-internal)

## SYNOPSIS

**struct usb\_device \* usb\_alloc\_dev(struct usb\_device \*** *parent***, struct usb\_bus \*** *bus***, unsigned** *port1***);**

## ARGUMENTS

*parent*

hub to which device is connected; null to allocate a root hub

*bus*

bus used to access the device

*port1*

one-based index of port; ignored for root hubs

## CONTEXT

!**in\_interrupt**

## DESCRIPTION

Only hub drivers (including virtual root hub drivers for host controllers) should ever call this.

This call may not be used in a non-sleeping context.

## RETURN

On success, a pointer to the allocated usb device. **NULL** on failure.

## COPYRIGHT
