sema_init() returns 0 if successful. When any of the following conditions is detected, sema_init() fails and returns the corresponding value.
EINVAL
Description:sp refers to an invalid semaphore.
EFAULT
Description:Either sp or arg point to an illegal address.