From: joe@perches.com (Joe Perches)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] dma: pl330: fix a couple of compilation warnings
Date: Sun, 08 Apr 2012 14:40:46 -0700 [thread overview]
Message-ID: <1333921246.2508.8.camel@joe2Laptop> (raw)
In-Reply-To: <1333919920-25481-1-git-send-email-olof@lixom.net>
On Sun, 2012-04-08 at 14:18 -0700, Olof Johansson wrote:
> Move a couple of tests and do a minor refactor to avoid:
[]
> diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c
[]
> @@ -2926,8 +2928,9 @@ pl330_probe(struct amba_device *adev, const struct amba_id *id)
> INIT_LIST_HEAD(&pd->channels);
>
> /* Initialize channel parameters */
> - num_chan = max(pdat ? pdat->nr_valid_peri : (u8)pi->pcfg.num_peri,
> - (u8)pi->pcfg.num_chan);
> + num_chan = max_t(int, pdat ? pdat->nr_valid_peri :
> + pi->pcfg.num_peri,
> + pi->pcfg.num_chan);
> pdmac->peripherals = kzalloc(num_chan * sizeof(*pch), GFP_KERNEL);
Few trivial things:
There's no error checking for a malloc failure
This should probably be kcalloc
The alignment here is not nice
Maybe:
num_chan = max_t(size_t, pdat ? pdat->nr_valid_peri : pi->pcfg.num_peri,
pi->pcfg.num_chan);
pdmac->peripherals = kcalloc(num_chan, sizeof(*pch), GFP_KERNEL);
if (!pdmac->peripherals)
goto some_err;
next prev parent reply other threads:[~2012-04-08 21:40 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-04-08 21:18 [PATCH] dma: pl330: fix a couple of compilation warnings Olof Johansson
2012-04-08 21:40 ` Joe Perches [this message]
2012-04-08 23:24 ` Olof Johansson
2012-04-09 5:02 ` Joe Perches
2012-04-08 23:26 ` [PATCH v2] " Olof Johansson
2012-04-25 9:37 ` Vinod Koul
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=1333921246.2508.8.camel@joe2Laptop \
--to=joe@perches.com \
--cc=linux-arm-kernel@lists.infradead.org \
/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