---
name: "device_delete_child"
section: "9"
platform: "freebsd"
package: "base"
version: "16.0-CURRENT-20261027-61c70dc16a79"
release: "FreeBSD 16.0-CURRENT (2026-10-27)"
platforms: ["linux", "freebsd"]
url: "https://new.carta.tech/device_delete_child"
---

# device\_delete\_child(9)

delete a child from a device

## NAME

**device\_delete\_child** – delete a child from a device

## SYNOPSIS

**#include \<sys/param.h\>**

**#include \<sys/bus.h\>**

*int*\

**device\_delete\_child**(*device\_t dev*, *device\_t child*);

## DESCRIPTION

The specified device is removed from *dev* and deleted. If the device is currently attached, it is first detached via [device\_detach(9)](/device_detach/9.md). If **device\_detach**() fails, its error value is returned. Otherwise, all descendant devices of *child* are deleted and zero is returned.

The [BUS\_CHILD\_DELETED(9)](/BUS_CHILD_DELETED/9.md) method is invoked for each device that is deleted. This permits the parent device's driver to tear down any state associated with child devices such as ivars.

## RETURN VALUES

Zero is returned on success, otherwise an error is returned.

## SEE ALSO

[BUS\_CHILD\_DELETED(9)](/BUS_CHILD_DELETED/9.md), [device\_add\_child(9)](/device_add_child/9.md)

## AUTHORS

This manual page was written by Doug Rabson.
