staging: bcm2835-camera: use kernel preferred style for handling errors
authorAishwarya Pant <aishpant@gmail.com>
Thu, 9 Mar 2017 19:01:36 +0000 (00:31 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 10 Mar 2017 09:13:07 +0000 (10:13 +0100)
This patch replaces NULL error values with error pointer values.

Signed-off-by: Aishwarya Pant <aishpant@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.c

index 2be6a040bbc1d03bdfdd1249fe3a172b09d565dd..803095ee6c85cbd2b8d99aff840845ec35d6f320 100644 (file)
@@ -262,7 +262,7 @@ get_msg_context(struct vchiq_mmal_instance *instance)
        msg_context = kzalloc(sizeof(*msg_context), GFP_KERNEL);
 
        if (!msg_context)
-               return NULL;
+               return ERR_PTR(-ENOMEM);
 
        msg_context->instance = instance;
        msg_context->handle =
@@ -272,7 +272,7 @@ get_msg_context(struct vchiq_mmal_instance *instance)
 
        if (!msg_context->handle) {
                kfree(msg_context);
-               return NULL;
+               return ERR_PTR(-ENOMEM);
        }
 
        return msg_context;
@@ -507,8 +507,8 @@ buffer_from_host(struct vchiq_mmal_instance *instance,
 
        /* get context */
        msg_context = get_msg_context(instance);
-       if (!msg_context) {
-               ret = -ENOMEM;
+       if (IS_ERR(msg_context)) {
+               ret = PTR_ERR(msg_context);
                goto unlock;
        }
 
@@ -845,8 +845,8 @@ static int send_synchronous_mmal_msg(struct vchiq_mmal_instance *instance,
        }
 
        msg_context = get_msg_context(instance);
-       if (!msg_context)
-               return -ENOMEM;
+       if (IS_ERR(msg_context))
+               return PTR_ERR(msg_context);
 
        init_completion(&msg_context->u.sync.cmplt);