lkml.org 
[lkml]   [2012]   [Apr]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH] dma: pl330: fix a couple of compilation warnings
From
On Sun, Apr 8, 2012 at 2:40 PM, Joe Perches <joe@perches.com> wrote:
> 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

Yes, this driver could do with further cleanups, congratulations on
your observations.

All of that is completely unrelated to this patch. Feel free to submit
your own changes to clean up the driver further.

> The alignment here is not nice

Bikeshed much? Let's just remove the ? : instead then. New patch shortly.


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

\
 
 \ /
  Last update: 2012-04-09 01:27    [W:2.023 / U:0.076 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site