From: Al Viro <viro@ZenIV.linux.org.uk>
To: "Dr. David Alan Gilbert" <linux@treblig.org>
Cc: linux-kernel@vger.kernel.org, nicolas.ferre@atmel.com,
dan.j.williams@intel.com, akpm@linux-foundation.org
Subject: Re: [PATCH] Fix missing 'cnt' in ?: in dmatest
Date: Sun, 21 Aug 2011 02:12:40 +0100 [thread overview]
Message-ID: <20110821011240.GG2203@ZenIV.linux.org.uk> (raw)
In-Reply-To: <20110821005031.GB10377@gallifrey>
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@treblig.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@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
next prev parent reply other threads:[~2011-08-21 1:12 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-08-21 0:50 [PATCH] Fix missing 'cnt' in ?: in dmatest Dr. David Alan Gilbert
2011-08-21 1:12 ` Al Viro [this message]
2011-08-25 22:55 ` Dan Williams
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20110821011240.GG2203@ZenIV.linux.org.uk \
--to=viro@zeniv.linux.org.uk \
--cc=akpm@linux-foundation.org \
--cc=dan.j.williams@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@treblig.org \
--cc=nicolas.ferre@atmel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox