From: SF Markus Elfring <hidden> Date: 2016-09-10 08:58:04
From: Markus Elfring <redacted>
Date: Sat, 10 Sep 2016 10:54:04 +0200
A few update suggestions were taken into account
from static source code analysis.
Markus Elfring (4):
Use kmalloc_array() in start_tx()
Improve a size determination in zatm_open()
Replace one kzalloc() call by kcalloc()
Fix indentation for one DPRINTK() call in start_rx()
drivers/atm/zatm.c | 16 +++++++++-------
1 file changed, 9 insertions(+), 7 deletions(-)
--
2.10.0
From: SF Markus Elfring <hidden> Date: 2016-09-10 09:00:44
From: Markus Elfring <redacted>
Date: Sat, 10 Sep 2016 09:55:53 +0200
* A multiplication for the size determination of a memory allocation
indicated that an array data structure should be processed.
Thus use the corresponding function "kmalloc_array".
This issue was detected by using the Coccinelle software.
* 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.
Signed-off-by: Markus Elfring <redacted>
---
drivers/atm/zatm.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
From: SF Markus Elfring <hidden> Date: 2016-09-10 09:01:48
From: Markus Elfring <redacted>
Date: Sat, 10 Sep 2016 10:07:38 +0200
Replace the specification of a data structure by a pointer dereference
as the parameter for the operator "sizeof" to make the corresponding size
determination a bit safer according to the Linux coding style convention.
Signed-off-by: Markus Elfring <redacted>
---
drivers/atm/zatm.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
From: SF Markus Elfring <hidden> Date: 2016-09-10 09:03:09
From: Markus Elfring <redacted>
Date: Sat, 10 Sep 2016 10:21:15 +0200
* 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 <redacted>
---
drivers/atm/zatm.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
@@ -598,12 +598,13 @@ static void close_rx(struct atm_vcc *vcc)staticintstart_rx(structatm_dev*dev){structzatm_dev*zatm_dev;-intsize,i;+inti;DPRINTK("start_rx\n");zatm_dev=ZATM_DEV(dev);-size=sizeof(structatm_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);
From: SF Markus Elfring <hidden> Date: 2016-09-10 09:04:24
From: Markus Elfring <redacted>
Date: Sat, 10 Sep 2016 10:38:04 +0200
Adjust the indentation for a call of the macro "DPRINTK" in this function.
Signed-off-by: Markus Elfring <redacted>
---
drivers/atm/zatm.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)