Re: [PATCH] no need for checking it

From: Figo.zhang
Date: Sat Jun 06 2009 - 07:09:12 EST


On Sat, 2009-06-06 at 13:56 +0300, Pekka Enberg wrote:
> On Sat, Jun 6, 2009 at 1:51 PM, Figo.zhang <figo1802@xxxxxxxxx> wrote:
> > vfree() does it's own NULL checking,so no need for check before
> > calling it.
> >
> > Signed-off-by: Figo.zhang <figo1802@xxxxxxxxx>
> > ---
> > 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@xxxxxxxxxxxxxxx
> > 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

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/