From mboxrd@z Thu Jan 1 00:00:00 1970 From: Geert Uytterhoeven Date: Fri, 13 Jan 2017 10:24:43 +0000 Subject: Re: [PATCH 1/3] sh/intc: Use kcalloc() in register_intc_controller() Message-Id: List-Id: References: <4d37c4d8-d28b-bd98-968b-f544d6a213eb@users.sourceforge.net> <6f6f99f6-26f0-d002-ca85-d974d71aa518@users.sourceforge.net> In-Reply-To: <6f6f99f6-26f0-d002-ca85-d974d71aa518@users.sourceforge.net> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: SF Markus Elfring Cc: Linux-sh list , Rich Felker , Yoshinori Sato , LKML , "kernel-janitors@vger.kernel.org" Hi Markus, On Fri, Jan 13, 2017 at 10:48 AM, SF Markus Elfring 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@linux-m68k.org 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 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751480AbdAMKYs (ORCPT ); Fri, 13 Jan 2017 05:24:48 -0500 Received: from mail-io0-f196.google.com ([209.85.223.196]:36726 "EHLO mail-io0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751356AbdAMKYo (ORCPT ); Fri, 13 Jan 2017 05:24:44 -0500 MIME-Version: 1.0 In-Reply-To: <6f6f99f6-26f0-d002-ca85-d974d71aa518@users.sourceforge.net> References: <4d37c4d8-d28b-bd98-968b-f544d6a213eb@users.sourceforge.net> <6f6f99f6-26f0-d002-ca85-d974d71aa518@users.sourceforge.net> From: Geert Uytterhoeven Date: Fri, 13 Jan 2017 11:24:43 +0100 X-Google-Sender-Auth: qQtwLFcJfjafwfWReKcvDjrcd68 Message-ID: Subject: Re: [PATCH 1/3] sh/intc: Use kcalloc() in register_intc_controller() To: SF Markus Elfring Cc: Linux-sh list , Rich Felker , Yoshinori Sato , LKML , "kernel-janitors@vger.kernel.org" Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Markus, On Fri, Jan 13, 2017 at 10:48 AM, SF Markus Elfring 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@linux-m68k.org 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