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

Andrew Morton
2007-04-29T03:26:24Z

On Sun, 29 Apr 2007 00:48:37 +0100 Andy Whitcroft <apw@shadowen.org> 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.