staging: comedi: serial2000: checkpatch.pl cleanup (kmalloc_array)
authorH Hartley Sweeten <hsweeten@visionengravers.com>
Wed, 16 Jul 2014 18:22:52 +0000 (11:22 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 16 Jul 2014 20:37:59 +0000 (13:37 -0700)
Fix the checkpatch.pl warning:

WARNING: Prefer kmalloc_array over kmalloc with multiply

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/comedi/drivers/serial2002.c

index e1fae7475b09ec39149c03dc3195e02274d9bdd2..167f82418cb4c84aad41ea615e055977dc21e374 100644 (file)
@@ -361,7 +361,8 @@ static int serial2002_setup_subdevice(struct comedi_subdevice *s,
        s->n_chan = chan;
        s->maxdata = 0;
        kfree(s->maxdata_list);
-       maxdata_list = kmalloc(sizeof(unsigned int) * s->n_chan, GFP_KERNEL);
+       maxdata_list = kmalloc_array(s->n_chan, sizeof(unsigned int),
+                                    GFP_KERNEL);
        if (!maxdata_list)
                return -ENOMEM;
        s->maxdata_list = maxdata_list;
@@ -371,9 +372,8 @@ static int serial2002_setup_subdevice(struct comedi_subdevice *s,
        if (kind == 1 || kind == 2) {
                s->range_table = &range_digital;
        } else if (range) {
-               range_table_list =
-                       kmalloc(sizeof(struct serial2002_range_table_t) *
-                               s->n_chan, GFP_KERNEL);
+               range_table_list = kmalloc_array(s->n_chan, sizeof(*range),
+                                                GFP_KERNEL);
                if (!range_table_list)
                        return -ENOMEM;
                s->range_table_list = range_table_list;
This page took 0.026341 seconds and 5 git commands to generate.