ATM-ZeitNet: Replace one kzalloc() call by kcalloc()
authorMarkus Elfring <elfring@users.sourceforge.net>
Sat, 10 Sep 2016 08:21:15 +0000 (10:21 +0200)
committerDavid S. Miller <davem@davemloft.net>
Sun, 11 Sep 2016 04:46:07 +0000 (21:46 -0700)
* The script "checkpatch.pl" can point information out like the following.

  WARNING: Prefer kcalloc over kzalloc with multiply

  Thus fix the affected source code place.

* Replace the specification of a data type by a pointer dereference
  to make the corresponding size determination a bit safer according to
  the Linux coding style convention.

* Delete the local variable "size" which became unnecessary with
  this refactoring.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/atm/zatm.c

index 218c6af60f21ff6004acbd53e065ede3da27df56..2cc9e2a63d3e36cc6cbf9e30a3ce7b4da7c33b26 100644 (file)
@@ -598,12 +598,13 @@ static void close_rx(struct atm_vcc *vcc)
 static int start_rx(struct atm_dev *dev)
 {
        struct zatm_dev *zatm_dev;
-       int size,i;
+       int i;
 
 DPRINTK("start_rx\n");
        zatm_dev = ZATM_DEV(dev);
-       size = sizeof(struct atm_vcc *)*zatm_dev->chans;
-       zatm_dev->rx_map =  kzalloc(size,GFP_KERNEL);
+       zatm_dev->rx_map = kcalloc(zatm_dev->chans,
+                                  sizeof(*zatm_dev->rx_map),
+                                  GFP_KERNEL);
        if (!zatm_dev->rx_map) return -ENOMEM;
        /* set VPI/VCI split (use all VCIs and give what's left to VPIs) */
        zpokel(zatm_dev,(1 << dev->ci_range.vci_bits)-1,uPD98401_VRR);