Use 2-factor multiplication argument form kcalloc() instead of kzalloc().
Unified · Split
| @@ -94,15 +94,13 @@ static int alloc_pending_queues(struct otx_cpt_pending_qinfo *pqinfo, u32 qlen, · 93 unmodified lines | |||
| 94 | u32 num_queues) | 94 | u32 num_queues) |
| 95 | { | 95 | { |
| 96 | struct otx_cpt_pending_queue *queue = NULL; | 96 | struct otx_cpt_pending_queue *queue = NULL; |
| 97 | size_t size; | ||
| 98 | int ret; | 97 | int ret; |
| 99 | u32 i; | 98 | u32 i; |
| 100 | 99 | ||
| 101 | pqinfo->num_queues = num_queues; | 100 | pqinfo->num_queues = num_queues; |
| 102 | size = (qlen * sizeof(struct otx_cpt_pending_entry)); | ||
| 103 | 101 | ||
| 104 | for_each_pending_queue(pqinfo, queue, i) { | 102 | for_each_pending_queue(pqinfo, queue, i) { |
| 105 | queue->head = kzalloc((size), GFP_KERNEL); | 103 | queue->head = kcalloc(qlen, sizeof(*queue->head), GFP_KERNEL); |
| 106 | if (!queue->head) { | 104 | if (!queue->head) { |
| 107 | ret = -ENOMEM; | 105 | ret = -ENOMEM; |
| 108 | goto pending_qfail; | 106 | goto pending_qfail; |