Re: [PATCH 1/3] sh/intc: Use kcalloc() in register_intc_controller()

From: Geert Uytterhoeven
Date: Fri Jan 13 2017 - 05:24:50 EST


Hi Markus,

On Fri, Jan 13, 2017 at 10:48 AM, SF Markus Elfring
<elfring@xxxxxxxxxxxxxxxxxxxxx> wrote:
> --- a/drivers/sh/intc/core.c
> +++ b/drivers/sh/intc/core.c

> @@ -253,7 +253,8 @@ int __init register_intc_controller(struct intc_desc *desc)
> }
>
> if (hw->prio_regs) {
> - d->prio = kzalloc(hw->nr_vectors * sizeof(*d->prio),
> + d->prio = kcalloc(hw->nr_vectors,
> + sizeof(*d->prio),

Please don't split lines without a good reason.

> GFP_NOWAIT);

In this particular case, I'd even use the opportunity to merge the above line
with the previous one instead, now it fits in 80 characters ;-)

> if (!d->prio)
> goto err4;
> @@ -269,7 +270,8 @@ int __init register_intc_controller(struct intc_desc *desc)
> }
>
> if (hw->sense_regs) {
> - d->sense = kzalloc(hw->nr_vectors * sizeof(*d->sense),
> + d->sense = kcalloc(hw->nr_vectors,
> + sizeof(*d->sense),

Likewise

> GFP_NOWAIT);
> if (!d->sense)

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds