All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] no need for checking it
@ 2009-06-06 10:51 Figo.zhang
  2009-06-06 10:56 ` Pekka Enberg
  2009-06-06 11:11 ` [PATCH V2] " Figo.zhang
  0 siblings, 2 replies; 5+ messages in thread
From: Figo.zhang @ 2009-06-06 10:51 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: Ian Abbott, Frank Mori Hess, David Schleef, lkml

vfree() does it's own NULL checking,so no need for check before
calling it.

Signed-off-by: Figo.zhang <figo1802@gmail.com>
---  
 drivers/staging/comedi/drivers.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/comedi/drivers.c
b/drivers/staging/comedi/drivers.c
index 6e13e45..ce50e85 100644
--- a/drivers/staging/comedi/drivers.c
+++ b/drivers/staging/comedi/drivers.c
@@ -495,9 +495,9 @@ int comedi_buf_alloc(struct comedi_device *dev,
struct comedi_subdevice *s,
 				vmap(pages, n_pages, VM_MAP,
 				PAGE_KERNEL_NOCACHE);
 		}
-		if (pages) {
-			vfree(pages);
-		}
+		vfree(pages);
+		pages = NULL;
+		
 		if (async->prealloc_buf == NULL) {
 			/* Some allocation failed above. */
 			if (async->buf_page_list) {



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

* Re: [PATCH] no need for checking it
  2009-06-06 10:51 [PATCH] no need for checking it Figo.zhang
@ 2009-06-06 10:56 ` Pekka Enberg
  2009-06-06 11:08   ` Figo.zhang
  2009-06-06 11:11 ` [PATCH V2] " Figo.zhang
  1 sibling, 1 reply; 5+ messages in thread
From: Pekka Enberg @ 2009-06-06 10:56 UTC (permalink / raw)
  To: Figo.zhang
  Cc: Greg Kroah-Hartman, Ian Abbott, Frank Mori Hess, David Schleef, lkml

On Sat, Jun 6, 2009 at 1:51 PM, Figo.zhang <figo1802@gmail.com> wrote:
> vfree() does it's own NULL checking,so no need for check before
> calling it.
>
> Signed-off-by: Figo.zhang <figo1802@gmail.com>
> ---
>  drivers/staging/comedi/drivers.c |    6 +++---
>  1 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/staging/comedi/drivers.c
> b/drivers/staging/comedi/drivers.c
> index 6e13e45..ce50e85 100644
> --- a/drivers/staging/comedi/drivers.c
> +++ b/drivers/staging/comedi/drivers.c
> @@ -495,9 +495,9 @@ int comedi_buf_alloc(struct comedi_device *dev,
> struct comedi_subdevice *s,
>                                vmap(pages, n_pages, VM_MAP,
>                                PAGE_KERNEL_NOCACHE);
>                }
> -               if (pages) {
> -                       vfree(pages);
> -               }
> +               vfree(pages);
> +               pages = NULL;

Why the assignment to NULL? It looks redundant to me.

> +
>                if (async->prealloc_buf == NULL) {
>                        /* Some allocation failed above. */
>                        if (async->buf_page_list) {
>
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
>

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

* Re: [PATCH] no need for checking it
  2009-06-06 10:56 ` Pekka Enberg
@ 2009-06-06 11:08   ` Figo.zhang
  0 siblings, 0 replies; 5+ messages in thread
From: Figo.zhang @ 2009-06-06 11:08 UTC (permalink / raw)
  To: Pekka Enberg
  Cc: Greg Kroah-Hartman, Ian Abbott, Frank Mori Hess, David Schleef, lkml

On Sat, 2009-06-06 at 13:56 +0300, Pekka Enberg wrote:
> On Sat, Jun 6, 2009 at 1:51 PM, Figo.zhang <figo1802@gmail.com> wrote:
> > vfree() does it's own NULL checking,so no need for check before
> > calling it.
> >
> > Signed-off-by: Figo.zhang <figo1802@gmail.com>
> > ---
> >  drivers/staging/comedi/drivers.c |    6 +++---
> >  1 files changed, 3 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/staging/comedi/drivers.c
> > b/drivers/staging/comedi/drivers.c
> > index 6e13e45..ce50e85 100644
> > --- a/drivers/staging/comedi/drivers.c
> > +++ b/drivers/staging/comedi/drivers.c
> > @@ -495,9 +495,9 @@ int comedi_buf_alloc(struct comedi_device *dev,
> > struct comedi_subdevice *s,
> >                                vmap(pages, n_pages, VM_MAP,
> >                                PAGE_KERNEL_NOCACHE);
> >                }
> > -               if (pages) {
> > -                       vfree(pages);
> > -               }
> > +               vfree(pages);
> > +               pages = NULL;
> 
> Why the assignment to NULL? It looks redundant to me.
> 
> > +
> >                if (async->prealloc_buf == NULL) {
> >                        /* Some allocation failed above. */
> >                        if (async->buf_page_list) {
> >
> >
> > --
> > To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> > the body of a message to majordomo@vger.kernel.org
> > More majordomo info at  http://vger.kernel.org/majordomo-info.html
> > Please read the FAQ at  http://www.tux.org/lkml/
> >

yes, 'pages' is local variable argment,it is no need assignment to NULL.

Best Regards,

Figo.zhang


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

* [PATCH V2] no need for checking it
  2009-06-06 10:51 [PATCH] no need for checking it Figo.zhang
  2009-06-06 10:56 ` Pekka Enberg
@ 2009-06-06 11:11 ` Figo.zhang
  2009-06-06 11:29   ` Pekka Enberg
  1 sibling, 1 reply; 5+ messages in thread
From: Figo.zhang @ 2009-06-06 11:11 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: Ian Abbott, Frank Mori Hess, David Schleef, lkml

vfree() does it's own NULL checking,so no need for check before
calling it.

'pages' is local variable argment,so in v2, it is no need assignment
 to NULL.

Signed-off-by: Figo.zhang <figo1802@gmail.com>
---   
drivers/staging/comedi/drivers.c |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/comedi/drivers.c b/drivers/staging/comedi/drivers.c
index 6e13e45..587283a 100644
--- a/drivers/staging/comedi/drivers.c
+++ b/drivers/staging/comedi/drivers.c
@@ -495,9 +495,8 @@ int comedi_buf_alloc(struct comedi_device *dev, struct comedi_subdevice *s,
 				vmap(pages, n_pages, VM_MAP,
 				PAGE_KERNEL_NOCACHE);
 		}
-		if (pages) {
-			vfree(pages);
-		}
+		vfree(pages);
+		
 		if (async->prealloc_buf == NULL) {
 			/* Some allocation failed above. */
 			if (async->buf_page_list) {



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

* Re: [PATCH V2] no need for checking it
  2009-06-06 11:11 ` [PATCH V2] " Figo.zhang
@ 2009-06-06 11:29   ` Pekka Enberg
  0 siblings, 0 replies; 5+ messages in thread
From: Pekka Enberg @ 2009-06-06 11:29 UTC (permalink / raw)
  To: Figo.zhang
  Cc: Greg Kroah-Hartman, Ian Abbott, Frank Mori Hess, David Schleef, lkml

On Sat, Jun 6, 2009 at 2:11 PM, Figo.zhang <figo1802@gmail.com> wrote:
> vfree() does it's own NULL checking,so no need for check before
> calling it.
>
> 'pages' is local variable argment,so in v2, it is no need assignment
>  to NULL.
>
> Signed-off-by: Figo.zhang <figo1802@gmail.com>

Looks good to me.

Acked-by: Pekka Enberg <penberg@cs.helsinki.fi>

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

end of thread, other threads:[~2009-06-06 11:30 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-06-06 10:51 [PATCH] no need for checking it Figo.zhang
2009-06-06 10:56 ` Pekka Enberg
2009-06-06 11:08   ` Figo.zhang
2009-06-06 11:11 ` [PATCH V2] " Figo.zhang
2009-06-06 11:29   ` Pekka Enberg

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.