[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20110821011240.GG2203@ZenIV.linux.org.uk>
Date: Sun, 21 Aug 2011 02:12:40 +0100
From: Al Viro <viro@...IV.linux.org.uk>
To: "Dr. David Alan Gilbert" <linux@...blig.org>
Cc: linux-kernel@...r.kernel.org, nicolas.ferre@...el.com,
dan.j.williams@...el.com, akpm@...ux-foundation.org
Subject: Re: [PATCH] Fix missing 'cnt' in ?: in dmatest
On Sun, Aug 21, 2011 at 01:50:31AM +0100, Dr. David Alan Gilbert wrote:
> (WTH is x=y?:z legal C anyway?)
gccism. It's not legal C; it's a gcc extension, and not a pretty one at
that. It's almost definitely a bug in this case - what used to be in the
tree is equivalent to cnt > 0 ? cnt > 0 : 0, i.e. cnt > 0 ? 1 : 0, i.e.
cnt > 0. AFAICS, after your patch it does make sense.
> Signed-off-by: Dr. David Alan Gilbert <linux@...blig.org>
>
> ---
> diff --git a/drivers/dma/dmatest.c b/drivers/dma/dmatest.c
> index 765f5ff..1b0ec9d 100644
> --- a/drivers/dma/dmatest.c
> +++ b/drivers/dma/dmatest.c
> @@ -572,7 +572,7 @@ static int dmatest_add_channel(struct dma_chan *chan)
> }
> if (dma_has_cap(DMA_PQ, dma_dev->cap_mask)) {
> cnt = dmatest_add_threads(dtc, DMA_PQ);
> - thread_count += cnt > 0 ?: 0;
> + thread_count += cnt > 0 ? cnt : 0;
> }
>
> pr_info("dmatest: Started %u threads using %s\n",
>
> --
> -----Open up your eyes, open up your mind, open up your code -------
> / Dr. David Alan Gilbert | Running GNU/Linux | Happy \
> \ gro.gilbert @ treblig.org | | In Hex /
> \ _________________________|_____ http://www.treblig.org |_______/
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@...r.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists