diff options
author | Aishwarya Pant <aishpant@gmail.com> | 2017-03-10 00:31:20 +0530 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2017-03-10 10:13:07 +0100 |
commit | 6aec8c56bc36f4fb4f315d14a8b6da434dd756a4 (patch) | |
tree | 16fd0ba63df18480da50c7003cba06ab9602e19c /drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.c | |
parent | staging: bcm2835-camera: add check to avoid null pointer dereference (diff) | |
download | linux-dev-6aec8c56bc36f4fb4f315d14a8b6da434dd756a4.tar.xz linux-dev-6aec8c56bc36f4fb4f315d14a8b6da434dd756a4.zip |
staging: bcm2835-camera: replace kmalloc with kzalloc
This patch replaces kmalloc and memset with kzalloc
Signed-off-by: Aishwarya Pant <aishpant@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.c')
-rw-r--r-- | drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.c b/drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.c index 436e489713e5..2be6a040bbc1 100644 --- a/drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.c +++ b/drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.c @@ -258,13 +258,12 @@ get_msg_context(struct vchiq_mmal_instance *instance) { struct mmal_msg_context *msg_context; - /* todo: should this be allocated from a pool to avoid kmalloc */ - msg_context = kmalloc(sizeof(*msg_context), GFP_KERNEL); + /* todo: should this be allocated from a pool to avoid kzalloc */ + msg_context = kzalloc(sizeof(*msg_context), GFP_KERNEL); if (!msg_context) return NULL; - memset(msg_context, 0, sizeof(*msg_context)); msg_context->instance = instance; msg_context->handle = mmal_context_map_create_handle(&instance->context_map, @@ -2017,12 +2016,11 @@ int vchiq_mmal_init(struct vchiq_mmal_instance **out_instance) return -EIO; } - instance = kmalloc(sizeof(*instance), GFP_KERNEL); + instance = kzalloc(sizeof(*instance), GFP_KERNEL); if (!instance) return -ENOMEM; - memset(instance, 0, sizeof(*instance)); mutex_init(&instance->vchiq_mutex); mutex_init(&instance->bulk_mutex); |