Re: [PATCH] mm/memory.c: remove warning from an uninitializedspinlock. was: Re: 2.6.21-rc7-mm2

From: Andrew Morton
Date: Sat Apr 28 2007 - 23:26:42 EST


On Sun, 29 Apr 2007 00:48:37 +0100 Andy Whitcroft <apw@xxxxxxxxxxxx> wrote:

> > +++ a/mm/memory.c
> > @@ -1455,7 +1455,7 @@ static int apply_to_pte_range(struct mm_
> > pte_t *pte;
> > int err;
> > struct page *pmd_page;
> > - spinlock_t *ptl;
> > + spinlock_t *ptl = ptl; /* Suppress gcc warning */
> >
> > pte = (mm == &init_mm) ?
> > pte_alloc_kernel(pmd, addr) :
> > _
> >
>
> Perhaps we should have some kind definition helper.
>
> #define suppress_unused(x) x = x
>
> spinlock_t *suppress_unused(ptl);
>
> Perhaps?

I think so. It makes it clear what's happening and it allows us to change
the implementation later on if the present trick stops working in later
gcc. It also allows people to suppress the suppression (some have
expressed concern that it can hide real bugs).

But I lost (or didn't pursue) the bunfight^Wdiscussion last time this came
around.

-
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/