diff --git a/arch/x86/events/zhaoxin/uncore.c b/arch/x86/events/zhaoxin/uncore.c index bde0693be1cddab298223351cece6d84a195b769..8a11fc98d4795c2d17606d8bb0a9beb2b1663591 100644 --- a/arch/x86/events/zhaoxin/uncore.c +++ b/arch/x86/events/zhaoxin/uncore.c @@ -1591,6 +1591,8 @@ static int uncore_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id loop = 1; boxes = kzalloc(loop * sizeof(struct zhaoxin_uncore_box *), GFP_KERNEL); + if (!boxes) + return -ENOMEM; for (i = 0; i < loop; i++) { type = uncore_pci_uncores[UNCORE_PCI_DEV_TYPE(id->driver_data) + j];