[PATCH 2/3] staging: octeon-usb: Replace kmalloc with kmalloc_array
Cristina Moraru
cristina.moraru09 at gmail.com
Wed Oct 21 01:20:21 EEST 2015
Replace kmalloc with specialized function kmalloc_array
when the size is a multiplication of:
number_of_elements * size_of_element
Signed-off-by: Cristina Moraru <cristina.moraru09 at gmail.com>
---
drivers/staging/octeon-usb/octeon-hcd.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/staging/octeon-usb/octeon-hcd.c b/drivers/staging/octeon-usb/octeon-hcd.c
index 6194028..6f28717 100644
--- a/drivers/staging/octeon-usb/octeon-hcd.c
+++ b/drivers/staging/octeon-usb/octeon-hcd.c
@@ -3216,9 +3216,9 @@ static int octeon_usb_urb_enqueue(struct usb_hcd *hcd,
* Allocate a structure to use for our private list of
* isochronous packets.
*/
- iso_packet = kmalloc(urb->number_of_packets *
- sizeof(struct cvmx_usb_iso_packet),
- GFP_ATOMIC);
+ iso_packet = kmalloc_array(urb->number_of_packets,
+ sizeof(struct cvmx_usb_iso_packet),
+ GFP_ATOMIC);
if (iso_packet) {
int i;
/* Fill the list with the data from the URB */
--
1.9.1
More information about the firefly
mailing list