All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] staging: bcm2835-camera: remove function get_msg_context
@ 2017-03-06 15:20 Aishwarya Pant
  2017-03-06 15:20 ` [PATCH 1/2] staging: bcm2835-camera: replace kmalloc and memset with kzalloc Aishwarya Pant
  2017-03-06 15:21 ` [PATCH 2/2] staging: bcm2835-camera: remove redundant function get_msg_context Aishwarya Pant
  0 siblings, 2 replies; 4+ messages in thread
From: Aishwarya Pant @ 2017-03-06 15:20 UTC (permalink / raw)
  To: Stephen Warren, Lee Jones, Eric Anholt, Greg Kroah-Hartman,
	Florian Fainelli, Ray Jui, Scott Branden,
	bcm-kernel-feedback-list
  Cc: outreachy-kernel

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(-)

-- 
2.7.4



^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/2] staging: bcm2835-camera: replace kmalloc and memset with kzalloc
  2017-03-06 15:20 [PATCH 0/2] staging: bcm2835-camera: remove function get_msg_context Aishwarya Pant
@ 2017-03-06 15:20 ` Aishwarya Pant
  2017-03-07 19:11   ` Greg Kroah-Hartman
  2017-03-06 15:21 ` [PATCH 2/2] staging: bcm2835-camera: remove redundant function get_msg_context Aishwarya Pant
  1 sibling, 1 reply; 4+ messages in thread
From: Aishwarya Pant @ 2017-03-06 15:20 UTC (permalink / raw)
  To: Stephen Warren, Lee Jones, Eric Anholt, Greg Kroah-Hartman,
	Florian Fainelli, Ray Jui, Scott Branden,
	bcm-kernel-feedback-list
  Cc: outreachy-kernel

This patch replaces kmalloc and memset with kzalloc

Signed-off-by: Aishwarya Pant <aishpant@gmail.com>
---
 drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.c b/drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.c
index ca6e9eb..ded9a99 100644
--- a/drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.c
+++ b/drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.c
@@ -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;
 }
-- 
2.7.4



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/2] staging: bcm2835-camera: remove redundant function get_msg_context
  2017-03-06 15:20 [PATCH 0/2] staging: bcm2835-camera: remove function get_msg_context Aishwarya Pant
  2017-03-06 15:20 ` [PATCH 1/2] staging: bcm2835-camera: replace kmalloc and memset with kzalloc Aishwarya Pant
@ 2017-03-06 15:21 ` Aishwarya Pant
  1 sibling, 0 replies; 4+ messages in thread
From: Aishwarya Pant @ 2017-03-06 15:21 UTC (permalink / raw)
  To: Stephen Warren, Lee Jones, Eric Anholt, Greg Kroah-Hartman,
	Florian Fainelli, Ray Jui, Scott Branden,
	bcm-kernel-feedback-list
  Cc: outreachy-kernel

This 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.

Signed-off-by: Aishwarya Pant <aishpant@gmail.com>
---
 drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.c | 15 ++-------------
 1 file changed, 2 insertions(+), 13 deletions(-)

diff --git a/drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.c b/drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.c
index ded9a99..1650bbf 100644
--- a/drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.c
+++ b/drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.c
@@ -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;
-- 
2.7.4



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/2] staging: bcm2835-camera: replace kmalloc and memset with kzalloc
  2017-03-06 15:20 ` [PATCH 1/2] staging: bcm2835-camera: replace kmalloc and memset with kzalloc Aishwarya Pant
@ 2017-03-07 19:11   ` Greg Kroah-Hartman
  0 siblings, 0 replies; 4+ messages in thread
From: Greg Kroah-Hartman @ 2017-03-07 19:11 UTC (permalink / raw)
  To: Aishwarya Pant
  Cc: Stephen Warren, Lee Jones, Eric Anholt, Florian Fainelli,
	Ray Jui, Scott Branden, bcm-kernel-feedback-list,
	outreachy-kernel

On Mon, Mar 06, 2017 at 08:50:55PM +0530, Aishwarya Pant wrote:
> This patch replaces kmalloc and memset with kzalloc
> 
> Signed-off-by: Aishwarya Pant <aishpant@gmail.com>
> ---
>  drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.c b/drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.c
> index ca6e9eb..ded9a99 100644
> --- a/drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.c
> +++ b/drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.c
> @@ -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


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-03-07 19:11 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-06 15:20 [PATCH 0/2] staging: bcm2835-camera: remove function get_msg_context Aishwarya Pant
2017-03-06 15:20 ` [PATCH 1/2] staging: bcm2835-camera: replace kmalloc and memset with kzalloc Aishwarya Pant
2017-03-07 19:11   ` Greg Kroah-Hartman
2017-03-06 15:21 ` [PATCH 2/2] staging: bcm2835-camera: remove redundant function get_msg_context Aishwarya Pant

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.