Skip to content

Commit ada2e40

Browse files
committed
firewire: ohci: use kcalloc() variant for array allocation
When allocating the list of isochronous context structure, a kzalloc() variant of managed device API is used. In this case, a kcalloc() variant is available. This commit replaces these lines with devm_kcalloc(). Link: https://lore.kernel.org/r/20250908012108.514698-2-o-takashi@sakamocchi.jp Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
1 parent a901f49 commit ada2e40

1 file changed

Lines changed: 2 additions & 5 deletions

File tree

drivers/firewire/ohci.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3482,7 +3482,6 @@ static int pci_probe(struct pci_dev *dev,
34823482
u32 bus_options, max_receive, link_speed, version;
34833483
u64 guid;
34843484
int i, flags, irq, err;
3485-
size_t size;
34863485

34873486
if (dev->vendor == PCI_VENDOR_ID_PINNACLE_SYSTEMS) {
34883487
dev_err(&dev->dev, "Pinnacle MovieBoard is not yet supported\n");
@@ -3576,8 +3575,7 @@ static int pci_probe(struct pci_dev *dev,
35763575
reg_write(ohci, OHCI1394_IsoRecvIntMaskClear, ~0);
35773576
ohci->ir_context_mask = ohci->ir_context_support;
35783577
ohci->n_ir = hweight32(ohci->ir_context_mask);
3579-
size = sizeof(struct iso_context) * ohci->n_ir;
3580-
ohci->ir_context_list = devm_kzalloc(&dev->dev, size, GFP_KERNEL);
3578+
ohci->ir_context_list = devm_kcalloc(&dev->dev, ohci->n_ir, sizeof(struct iso_context), GFP_KERNEL);
35813579
if (!ohci->ir_context_list)
35823580
return -ENOMEM;
35833581

@@ -3591,8 +3589,7 @@ static int pci_probe(struct pci_dev *dev,
35913589
reg_write(ohci, OHCI1394_IsoXmitIntMaskClear, ~0);
35923590
ohci->it_context_mask = ohci->it_context_support;
35933591
ohci->n_it = hweight32(ohci->it_context_mask);
3594-
size = sizeof(struct iso_context) * ohci->n_it;
3595-
ohci->it_context_list = devm_kzalloc(&dev->dev, size, GFP_KERNEL);
3592+
ohci->it_context_list = devm_kcalloc(&dev->dev, ohci->n_it, sizeof(struct iso_context), GFP_KERNEL);
35963593
if (!ohci->it_context_list)
35973594
return -ENOMEM;
35983595

0 commit comments

Comments
 (0)