---
name: "kobject_init_and_add"
section: "9"
platform: "linux"
package: "linux-manual-3.16"
version: "3.16.56-1+deb8u1"
release: "Debian 8 (Jessie)"
platforms: ["linux"]
url: "https://new.carta.tech/kobject_init_and_add"
---

# kobject\_init\_and\_add(9)

initialize a kobject structure and add it to the kobject hierarchy

## NAME

kobject\_init\_and\_add - initialize a kobject structure and add it to the kobject hierarchy

## SYNOPSIS

**int kobject\_init\_and\_add(struct kobject \*** *kobj***, struct kobj\_type \*** *ktype***, struct kobject \*** *parent***, const char \*** *fmt***,** *...***);**

## ARGUMENTS

*kobj*

pointer to the kobject to initialize

*ktype*

pointer to the ktype for this kobject.

*parent*

pointer to the parent of this kobject.

*fmt*

the name of the kobject.

*...*

variable arguments

## DESCRIPTION

This function combines the call to **kobject\_init** and **kobject\_add**. The same type of error handling after a call to **kobject\_add** and kobject lifetime rules are the same here.

## COPYRIGHT
