staging: bcm2835-camera: remove function get_msg_context
Subsystems (3)
cover staging: bcm2835-camera: remove function get_msg_context
This patchset safely replaces function get_msg_context with a memory allocation at the caller.
Aishwarya Pant (2):
staging: bcm2835-camera: replace kmalloc and memset with kzalloc
staging: bcm2835-camera: remove redundant function get_msg_context
.../staging/vc04_services/bcm2835-camera/mmal-vchiq.c | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-)
Signature · 1 line
2.7.4
PATCH 1/2 staging: bcm2835-camera: replace kmalloc and memset with kzalloc
This patch replaces kmalloc and memset with kzalloc
--- drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.c +2 -3
@@ -168,9 +168,8 @@ static struct mmal_msg_context *get_msg_context(struct vchiq_mmal_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 ); -memset (msg_context,0 ,sizeof (*msg_context)); +/* todo: should this be allocated from a pool to avoid kzalloc */ + msg_context =kzalloc (sizeof (*msg_context),GFP_KERNEL );return msg_context; }
Signature · 1 line
2.7.4
Greg Kroah-Hartman
maintainerRe: [PATCH 1/2] staging: bcm2835-camera: replace kmalloc and memset with kzalloc
Quoted 12 lines · Aishwarya Pant
This patch replaces kmalloc and memset with kzalloc
Signed-off-by Aishwarya Pant <[email protected]>--- drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.c +0
-0
drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.c static struct mmal_msg_context *get_msg_context(struct vchiq_mmal_instance · line 172
Quoted 8 lines
drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.c +2
-3@@ -168,9 +168,8 @@ static struct mmal_msg_context *get_msg_context(struct vchiq_mmal_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 ); -memset (msg_context,0 ,sizeof (*msg_context)); +/* todo: should this be allocated from a pool to avoid kzalloc */ + msg_context =kzalloc (sizeof (*msg_context),GFP_KERNEL );
This patch isn't needed in this series anymore, right? Please resend just the needed patch, don't change code that is going to be deleted on the next one for no reason.
thanks,
greg k-h
PATCH 2/2 staging: bcm2835-camera: remove redundant function get_msg_context
In reply to Aishwarya PantThis patch removes get_msg_context(..) with a kzalloc at the caller. This is safe as the only usage was found in mmal-vchiq.c which has been refactored.
--- drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.c | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-)
drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.c +2 -13
@@ -163,17 +163,6 @@ struct vchiq_mmal_instance {struct vchiq_mmal_component component[VCHIQ_MMAL_MAX_COMPONENTS ]; }; -static struct mmal_msg_context *get_msg_context (struct vchiq_mmal_instance - *instance) -{ -struct mmal_msg_context *msg_context; - -/* todo: should this be allocated from a pool to avoid kzalloc */ - msg_context =kzalloc (sizeof (*msg_context),GFP_KERNEL ); - -return msg_context; -} -static void release_msg_context (struct mmal_msg_context *msg_context) {kfree (msg_context);
@@ -394,8 +383,8 @@ buffer_from_host(struct vchiq_mmal_instance *instance,if (mutex_lock_interruptible (&instance->bulk_mutex))return -EINTR ; -/* get context */ - msg_context =get_msg_context (instance); +/* todo: should this be allocated from a pool to avoid kzalloc */ + msg_context =kzalloc (sizeof (*msg_context),GFP_KERNEL );if (!msg_context) { ret = -ENOMEM ; goto unlock;
Signature · 1 line
2.7.4