API needs to check KObject types

The Issue

Currently, only some API calls check to see if accepted KObjects are the correct type. Although all API's check for this through an assert(), this will do absolutely nothing when built in Release mode. Consequently, if a user were to pass the wrong type of KObject (let's face it, this could certainly happen since they are generic) then the subsequent call to container_of() would result in very bad things going down.

The Solution

All API calls accepting KObject types must:

  1. Check if each KObject is NULL. If so, return NULL_INPUT if the return type is KErrorCode
  2. Check if each KObject has the expected KObjectType (via kobject_type()). If not, return WRONG_KOBJECT_TYPE if the return type is KErrorCode